Your java application it utilizing very high cpu (eg: 100%), you do not know which java thread is causing this. In Java Web Application which is a multi-threaded environment, it becomes important to know this. Thread Dumps tell us what the threads are doing, but they do not tell us which thread is utilizing the maximum CPU.
On Linux, following commands will help us:
top command can tell us which (java or any) process is utilizing how much CPU
top -H command gives similar output, but this time by Linux Threads (instead of Processes), so from here we can determine the thread id that is using large cpu. But remember this thread id is decimal notation, while jstack output (thread dump) has thread id in hexadecimal so a conversion from decimal to hexadecimal is needed, before you can locate the offending thread in thread dump (the ‘nid’ field in thread dump corresponds to it).
On Linux you can convert decimal to hex as follows:
Here is what your a contents of Thread Dump looks like (see the nid=0x7541 below):
'Busy' prio=10 tid=0x8f3cf400 nid=0x7541 runnable [0x3f25b120] java.lang.Thread.State: RUNNABLE at java.something.do(Whatever.java:114)
Other Unix Flavors:
- Solaris: use ‘prstat’ command
- AIX: instead of ‘top -H’, you could use ‘ps -mp’. See here: http://javaeesupportpatterns.blogspot.in/2011/12/prstat-aix-how-to-pinpoint-high-cpu.html