Let’s Talk

We would love to hear from you. Want to know more about
our services or have any questions? Say Hi!

SOLR JVM Memory Getting Full

November 17, 2022
SOLR JVM Memory Getting Full
Mitesh Patel
Mitesh Patel
Technical Head

So many times, we face the issue of SOLR where it doesn’t give proper results due to the high usage of SOLR. And due to that only sometimes it gives results and sometimes it doesn’t.

Let me tell you why this happens

What is default JVM Memory setup?

Whenever we install SOLR it has default memory setup is 512MB space usage permission.

What will be the most reliable setting for memory usage?

Basically, it is all up to your project and requests that how many requests you are sending and how big the request is. But if your system has enough space in free storage and RAM is more than 8GB then you can easily set the 2GB JVM memory for solr.

It will not hamper for your local environment or staging environment because those servers have less requests but for the production, I would suggest having special solr server which is configured for using solr only. All the solr related work will be managed by that only so that even if you are having a lot of traffic, it can manage everything.

If we talk about JVM memory for prod I would suggest if the prod solr server has 16 GB RAM you can easily assign 12 GB.

How to increase the JVM Memory setting?
  1. To increase you will need to go for the solr installed folder.
  2. Once you get in there you will have to go for the bin folder.
  3. In the bin folder you will be able to see solr.in.cmd file simply right click on it and open it in notepad.
  4. in the solr.in.cmd file search for the SOLR_JAVA_MEM you will get below line.

    “REM set SOLR_JAVA_MEM=-Xms512m -Xmx512m”

  5. Once you get this line Remove the REM because it is used to comment the code.
  6. After removing, increase the memory as per your configuration for example if you want to set for 2GB then you have to write 2g at 512m so just replace the 512m with 2g.
  7. Once you change that you will have to save the file.
  8. After saving the file Go the the windows services centre in services search for your SOLR service and restart the specific solr service for which you have made change into solr.in.cmd
  9. That’s it. After restarting go to the SOLR site and refresh the dashboard and you will be able to see the JVM Memory increased to 2 GB.