As with all the applications running inside the Java virtual machine, Solr can also have problems with garbage collection running too long. You may never encounter this kind of a problem, or you may suffer from it and don't know what is actually happening. This recipe will show you how to deal with garbage collection running too long.
For the purpose of this recipe, I assumed that we have a machine with multiple cores (or multiple processor units), Java 6, and run Solr with the following command:
java –Xms256M –Xmx2048 –jar start.jar
After running for a longer period of time, you notice that Solr starts to hang for short periods of time and doesn't respond during that time. Actually, Jetty doesn't respond either. After that, everything goes back to normal for some time and then it happens again. This usually means that we have a problem with garbage collection running too long.
What can we do about that? Let's modify the Solr...