Thread Dump Analysis Pattern

Thread Dump Analysis Pattern

Threads in ‘runnable’ state consume CPU. So when you are analyzing thread dumps for high CPU consumption, threads in ‘runnable’ state should be thoroughly reviewed. Typically, in thread dumps several threads are classified in ‘RUNNABLE’ state. But in reality several of them wouldn’t be actually running, rather they would be just waiting. But still, JVM classifies them in ‘RUNNABLE’ state. You need to learn to differentiate from really running threads with pretending/misleading RUNNABLE threads.


Below is the real world thread dump excerpt. In these stack traces, threads aren’t actually in ‘RUNNABLE’ state, i.e. they are not actively executing any code. They are just waiting on the sockets to read or write. It’s because JVM doesn’t really know what thread is doing in a native method, JVM classifies them in ‘RUNNABLE’ state. Real running threads would consume CPU, whereas these threads are on I/O wait, which don’t consume any CPU.

WorkerThread#27[] - priority:10 - threadId:0x00002b59983cb000 - nativeId:0x4482 - addressSpace:null - state:RUNNABLEstackTrace:	java.lang.Thread.State: RUNNABLE	at Method)	at	at	at	at	- locked  (a	at	at org.jboss.jms.server.remoting.ServerSocketWrapper.checkConnection(	at org.jboss.remoting.transport.socket.ServerThread.acknowledge(	at org.jboss.remoting.transport.socket.ServerThread.dorun(	at receiver,GATES-RefData-Infinispan-Cluster,matcamupa67-vm-46719 - priority:10 - threadId:0x00002b597c1ba800 - nativeId:0x3034 - addressSpace:null - state:RUNNABLEstackTrace:	java.lang.Thread.State: RUNNABLE	at Method)	- locked  (a	at	- locked  (a	at	- locked  (a	- locked  (a	at org.jgroups.protocols.UDP$PacketReceiver.__AW_run(	at org.jgroups.protocols.UDP$	at 

Tool to analyze thread dumps:


Share the Post: