3

Sometimes in the development or other environments (QA,STG,PROD), it is required to increase the size of JVM (Java Virtual Machine) memory.

How can we increase the JVM memory?

The size is of this memory is displayed on the Solr admin page. enter image description here

  • 4
    To prevent discussions about it's fitness for purpose on this site, I quote the Pee Wee Herman rule. I believe this to be a valid question in a Sitecore context. stackoverflow.blog/2010/11/29/the-pee-wee-herman-rule – Mark Cassidy Aug 5 '19 at 16:06
  • Somebody downvoted this question. It will be nice if people write the reasons for the downvotes. So we can understand the reasons and improve the questions or answers. Otherwise, everybody can randomly downvote for no reason. – Ercan Polat Sep 4 '19 at 14:36
9

The default size that is set is 512MB, but can be changed by adjusting the solr settings.

You can increase the memory by doing the following:

  1. Open the {INSTALLDIR}\bin\solr\solr.in.cmd file in a text editor of your choice
  2. Search for the following REM set SOLR_JAVA_MEM=-Xms512m -Xmx512m
  3. You can copy paste the line or just remove the REM portion to allow a new value to be set
  4. Replace the -Xms512m -Xmx512m value with the value you want (1GB would be -Xms1g -Xmx1g, 10GB would be -Xms10g -Xmx10g, etc)
  5. Save the file and restart your Solr service for the new size to be applied.
| improve this answer | |
1

You can also use -m parameter to set memory during executing solr start command.

For example, if you want to set memory as 2 GB then you can write the command as below

solr start -f -port 8080 -m 2g

| improve this answer | |
  • I tested this, yes it starts solr with increased JVM memory. However, it is not permanently. When windows solr service starts the solr instance it resets to the default value. As my understanding, this is not a solution. – Ercan Polat Sep 12 '19 at 20:09
  • @Ercan Polat How did you setup windows service? I have used nssm.exe to create windows service for one of my projects and passed -m parameter and it works always. And I always prefer this option over others as it is flexible and do not require any file to be updated. – Surya Narayan Sep 12 '19 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.