: Till 3 days ago, we were running Solr 3.4 instance with following java
: command line options
: java -server -*Xms2048m* -*Xmx4096m* -Dsolr.solr.home=etc -jar start.jar
: 
: Then we increased the memory with following options and restarted the
: server
: java -server *-**Xms4096m* -*Xmx10g* -Dsolr.solr.home=etc -jar start.jar
        ...
: Since we restarted Solr, the memory usage of application is continuously
: increasing. The swap usage goes from almost zero to as high as 4GB in every
: 6-8 hours. We kept restarting the Solr to push it down to ~zero but the
: same memory usage trend kept repeating itself.

do you really mean "swap" in that sentence, or do you mean the amount of 
memory your OS says java is using?  You said you have 16GB total 
physical ram, how big is the index itself? do you have any other processes 
running on that machine?  (You should ideally leave at least enough ram 
free to let the OS/filesystem cache the index in RAM)

Since you've not only changed the Xmx (max heap size) param but also the 
Xms param (min heap size) to 4GB, it doesn't seem out of the ordinary 
at all for the memory usage to jump up to 4GB quickly.  If the JVM did 
exactly what the docs say it should, then on startup it would 
*immediatley* allocated 4GB or ram, but i think in practice it allocates 
as needed, but doesn't do any garbage collection if the memory used is 
still below the "Xms" value.

: Then finally I reverted the least expected change, the command line memory
: options, back to min 2g, max 4g and I was surprised to see that the problem
: vanished.
: java -server *-Xms2g* *-Xmx4g* -Dsolr.solr.home=etc -jar start.jar
: 
: Is this a memory leak or my lack of understanding of java/linux memory
: allocation?

I think you're just missunderstanding the allocation ... if you tell java 
to use at leaast 4GB, it's going to use at least 4GB w/o blinking.

did you try "-Xms2g -Xmx10g" ?

(again: don't set Xmx any higher then you actually have the RAM to 
support given the filesystem cache and any other stuff you have running, 
but you can increase mx w/o increasing ms if you are just worried about 
how fast the heap grows on startup ... not sure why that would be 
worrisome though


-Hoss

Reply via email to