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.

Example

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[10.201.1.55:56893] - priority:10 - threadId:0x00002b59983cb000 - nativeId:0x4482 - addressSpace:null - state:RUNNABLEstackTrace:	java.lang.Thread.State: RUNNABLE	at java.net.SocketInputStream.socketRead0(Native Method)	at java.net.SocketInputStream.__AW_read(SocketInputStream.java:129)	at java.net.SocketInputStream.read(SocketInputStream.java)	at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)	at java.io.BufferedInputStream.read(BufferedInputStream.java:237)	- locked  (a java.io.BufferedInputStream)	at java.io.DataInputStream.readByte(DataInputStream.java:248)	at org.jboss.jms.server.remoting.ServerSocketWrapper.checkConnection(ServerSocketWrapper.java:94)	at org.jboss.remoting.transport.socket.ServerThread.acknowledge(ServerThread.java:857)	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:585)	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)multicast receiver,GATES-RefData-Infinispan-Cluster,matcamupa67-vm-46719 - priority:10 - threadId:0x00002b597c1ba800 - nativeId:0x3034 - addressSpace:null - state:RUNNABLEstackTrace:	java.lang.Thread.State: RUNNABLE	at java.net.PlainDatagramSocketImpl.receive0(Native Method)	- locked  (a java.net.PlainDatagramSocketImpl)	at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:145)	- locked  (a java.net.PlainDatagramSocketImpl)	at java.net.DatagramSocket.receive(DatagramSocket.java:725)	- locked  (a java.net.DatagramPacket)	- locked  (a java.net.MulticastSocket)	at org.jgroups.protocols.UDP$PacketReceiver.__AW_run(UDP.java:675)	at org.jgroups.protocols.UDP$PacketReceiver.run(UDP.java)	at java.lang.Thread.run(Thread.java:662) 

Tool to analyze thread dumps: http://fastthread.io/.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS