What tool to use to identify a high-CPU Tomcat thread

monitoringtomcat7

We have a load balanced server farm using Tomcat 7. Once in a while (once a day, at least) a server's CPU load spikes way up. This appears to be legitimate server usage and not a fault, but I can't figure out how to identify what particular site usage is causing these CPU spikes.

Here are the tools we are using:

  • Javamelody, which shows long-running calls but not when they happened.
  • Zabbix, which shows CPU usage but not what's causing it.
  • The server logs, which, by management directive, only show the threads but not any statistics.

Is there some way to tie these together and find out what threads were running at the time of the spike?

Or is there a better tool we need to use?

Best Answer

Java Flight Recorder and Java Mission Control is worth a try if Oracle Hotspot Jdk 1.7u40+ runs Tomcat. Remember, you must run the JVM with the JVM argument -XX:+UnlockCommercialFeatures and provide JMX support to be able to connect to the Java process with JMC.