Java – Tools and Tips for Sun JVM Troubleshooting

coldfusionjava

We run a cluster of ColdFusion 8 servers on top of the Sun JVM, version 1.6.0_11. Occasionally a server will simply stop responding to requests. We've determined so far that the JVM is locking up and that neither ColdFusion nor IIS are the root of the problem. I've included our JVM arguments below. Any additional JVM settings we should be looking at? Any tools to monitor, trace, or get metrics from inside the JVM so we can see what it's doing when the crashes occur? Any other JVM troubleshooting tips?

-server
-Xms1024m
-Xmx1024m
-Dsun.io.useCanonCaches=false
-XX:MaxPermSize=256m
-XX:PermSize=256m
-XX:+UseParallelGC
-Dsun.rmi.dgc.client.gcInterval=300000
-Dsun.rmi.dgc.server.gcInterval=300000
-Djmx.invoke.getters=true

Best Answer

If you are on Linux you could use kill -3 to get a thread dump and look for deadlocks using using Thread Dump Analyzer.

VisualVM now ships as part of the JDK and can be used monitor memory usage, threads and also includes a profiler.

jmap can be used to obtain heap histograms and heap dumps from Java processes. You could then use a tool like Eclipse Memory Analyzer to investigate it.

As another answer mentioned you could look into JMX and JConsole. For each service in our application we have a MBean so we can view keys stats such as queue sizes to check if anything seems out of the ordinary.