Analysing which Java process is hiting High CPU and ways to rectify the issue


run top (shift)H and get PID of the thread with highest CPU.

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
19848 x_xxx     25   0 1467m 753m 9832 S 406.4  0.5  35372:22 java

convert the PID to hex. 

Refer http://www.binaryhexconverter.com/decimal-to-hex-converter


19848 >> 0x4d88
nid=0x4d88 -> Search this in the Thread Dump

 (jstack > ) /cfp/apps/java/jdk1.6.0_30/bin/jstack 19848 > /var/tmp/ThreadDump.txt


look for thread with the matching HEX PID in your thread dump.
You can use tools like Visual VM to analyse jmap and the Thread Dump
Vicual VM -> CPU tab

1 comments:

randy said...

Hi, very interesting post thanks for sharing. Would you please consider adding a link to my website on your page ? Please email me back. Thanks!

Randy
randydavis387 at gmail.com