How can I increase heap space memory in Solr-5.0? I just want to set minimum and maximum Heap space memory of Solr.
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

- 721
- 8
- 10
-
2@RonakShah Try below on your console. `./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` This exactly answers the question. – Madhav Feb 15 '16 at 20:32 -
1@RonakShah This is indeed an answer to the question. It is describing an another way of setting JVM heap space which is what question is about! Please do not criticize a good answer. – Pratik Patel Aug 04 '16 at 07:10
This info is in the WIKI: https://cwiki.apache.org/confluence/display/solr/Taking+Solr+to+Production#TakingSolrtoProduction-MemoryandGCSettings
SOLR_JAVA_MEM="-Xms10g -Xmx10g"

- 68,075
- 43
- 96
- 126

- 2,549
- 17
- 9
Follow the below steps to increase the JVM memory in Solr:
Open solr.in.cmd in any text editor (path: bin/solr.in.cmd)
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)
- save the solr.in.cmd file and restart the solr

- 101
- 1
- 2
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

- 349
- 1
- 4
-
1Thanks for the post... Worked for me with Solr 8.3 on CentOS as well. Methods in other answers above did not. – CommonKnowledge Dec 17 '19 at 03:25
-
1Editing a program's defaults is not the way. You'll lose this when you update. Edit the appropriate config files, please. In the case of Solr 7, there's commented out directives you can customise in the default /etc/default/solr.in.sh. – Benny Mackney Aug 13 '21 at 02:28