Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set JVM-Memory in Solr-5.0

Tags:

solr

How can I increase heap space memory in Solr-5.0? I just want to set minimum and maximum Heap space memory of Solr.

like image 433
Ankita Avatar asked Mar 13 '15 10:03

Ankita


People also ask

How much memory should I allocate with SOLR?

If your OS, Solr's Java heap, and all other running programs require 4GB of memory, then an ideal memory size for that server is at least 12GB. You might be able to make it work with 8GB total memory (leaving 4GB for disk cache), but that also might NOT be enough.

How much memory should I allocate to JVM?

Therefore we recommended that physical memory availability for each JVM be 4096 MB;0.5 GB is for JVM allocation and 512 MB is for overhead. This simplified calculation means that a 64-bit system with 16 GB physical memory can run 3 JVMs.


4 Answers

How about using -m option

./solr restart -m 1g

From ./solr --help -

-m Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g results in: -Xms4g -Xmx4g; by default, this script sets the heap size to 512m

like image 166
Madhav Avatar answered Sep 22 '22 14:09

Madhav


This info is in the WIKI: https://cwiki.apache.org/confluence/display/solr/Taking+Solr+to+Production#TakingSolrtoProduction-MemoryandGCSettings

SOLR_JAVA_MEM="-Xms10g -Xmx10g"

like image 20
Okke Klein Avatar answered Sep 22 '22 14:09

Okke Klein


Follow the below steps to increase the JVM memory in Solr:

  1. Open solr.in.cmd in any text editor (path: bin/solr.in.cmd)

  2. Add the set SOLR_JAVA_MEM=-Xms1g -Xmx1g ( it will set the minimum and maximum Java heap memory by 1 GB. however you will only able the see 981.38 MB in solr dashboard)

  3. save the solr.in.cmd file and restart the solr
like image 36
Ravindra Giri Avatar answered Sep 19 '22 14:09

Ravindra Giri


For Centos 7 the modification is in the file bin/solr, e.g. to increase it to 5G :

vim /opt/solr/bin/solr

Edit the block of code:

JAVA_MEM_OPTS=()
if [ -z "$SOLR_HEAP" ] && [ -n "$SOLR_JAVA_MEM" ]; then
  JAVA_MEM_OPTS=($SOLR_JAVA_MEM)
else
  SOLR_HEAP="${SOLR_HEAP:-512m}"
  JAVA_MEM_OPTS=("-Xms5g" "-Xmx5g")
fi
like image 24
Alejandro T Avatar answered Sep 18 '22 14:09

Alejandro T