Increasing Jetty/Solr heapspace
Asked Answered
C

1

6

I'm running Cygwin with Jetty and Solr431.

Here's the contents of my .bat file I use to start Solr:

@echo off
C:
chdir C:\cygwin\bin

bash -c "cd /cygdrive/c/Databases/apache-solr-3.5.0/example/; java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar" 

After all is running a while the console window displays the error:

Java heap space out of memory

How can I see how much heap space is allocated right now and how can I increase it? I read that I need to add a parameter like -Xmx500M to the startup command, but I don't know where.

UPDATE

with jps command I found the correct PID.

Then I got these results. I thought the P column would show the permitted heapspace, but I don't see if my command parameters had any effect?

without any startup parameters

jstat -gcutil 4932 5000

  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
100,00   0,00  74,91  65,67  99,23    300    0,348     4    0,146    0,494
100,00   0,00  74,91  65,67  99,23    300    0,348     4    0,146    0,494

with parameters

bash -c "cd /cygdrive/c/Databases/apache-solr-3.5.0/example/;java -Dsolr.solr.home="./example-DIH/solr/" -jar -Xmx200m -Xmx400m start.jar" jstat -gcutil 2548 5000

  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
  0,00  89,57  67,80  62,74  99,45    307    0,337     4    0,147    0,484
  0,00  89,57  67,80  62,74  99,45    307    0,337     4    0,147    0,484
Casandracasanova answered 5/11, 2013 at 13:41 Comment(0)
H
7

You need to add the -Xmx500m just before start.jar.

Additional information -

Initial Heap size -Xms<size>
Maximum Heap size -Xmx<size>

To find out the Heap Size for the current running process you need jstat -gc <pid>. For details have a look here.

Hepzi answered 5/11, 2013 at 13:46 Comment(6)
Thanks. And is there a way to see what is currently allocated? Also I believe there is a way to set a min-heap space and max heapspace? Do you know how?Casandracasanova
Added the info in the answerHepzi
Thanks again. And how can I start jstat? I don't see in in the \bin folder of my JRE folder. And how do I find the pid? I checked my taskmanager but there I don't see either Jetty, Cygwin or Solr process, just a java.exeCasandracasanova
any idea how I can start jstat and find the relevant pid? Thanks!Casandracasanova
Have a look thecoderscorner.com/team-blog/java-and-jvm/…Hepzi
I did, and added the test results. Can't make much sense of it though. Could you advise please? Thank you again!Casandracasanova

© 2022 - 2024 — McMap. All rights reserved.