Solr with VisualVM via JMX

Recently I had a need to measure Solr memory usage and I decided to use free Oracle tool - VisualVM. As usual an official documentation provides some help, but to make things simpler I extended my Solr startup script for Windows to put all important information in one place.

The core change is to add a few JVM parameters on Solr startup: \ \ \ \ \

Documentation provides simpler way to do that, but I prefer to declare things explicitly. Having this parameters passed to starting Solr you can connect to server by opening VisualVM and choosing:

Local > Add JMX Connection > localhost:[port number, in our case 18983]

Below you can see an example of VisualVM heap memory output for Solr 5 indexing 1k documents.


Happy using but be careful, JMX connection should not be allowed in production environment!