Debugging High CPU usage on J2EE app - JTOP

To debug high CPU usage on Java app, run JTOP with:

java -jar %JDK_HOME%\demo\management\JTop\JTop.jar <hostaddr>:<port>

The JVM must be started with the following options set:


JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=11099"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"


Find the outlier threads

Do one of the following to get the Java PID:

ps -ef | grep java
OR
jps
OR
jconsole

Execute one of the following to get a thread stack dump:
kill -3 <pid>
OR
jstack <pid> > %lt;someFile>
OR
jconsole - connect to VM, click on Threads tab, select thread
OR
jvisualvm - connect to VM, click thread dump button

Analyze the thread stack to see where the code is executing causing high CPU

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout