Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Thread Dump Summarisation Tool

I sometimes have to look at thread dumps from a Tomcat server. However, this is a very slow process as my application uses thread pools with a couple of hundred threads. Most of the thread dumps I look at include the same stack trace for many of the threads as they are idle waiting for work.

Are there any tools which would parse a thread dump and only show me the unique stack traces along with a count of the number of threads in each state? This would allow me to quickly ignore the tens or hundreds of threads which are waiting in a common location for work.

I have tried the Thread Dump Analyzer but this doesn't do any summarisation of common stack traces.

like image 219
mchr Avatar asked Jun 20 '11 21:06

mchr


People also ask

How do you Analyse a thread dump with a tool?

To find the long running threads, highlight all the thread dumps you want to check, and then click on the binoculars: In the pop up dialogue, click start detection, and you'll get your long running threads just below the dumps themselves: In my example, each thread dump has 157 threads.

How do you take thread dump in Java?

To take a thread dump, navigate to the console used to launch the Java application, and press the CTRL and Break keys together. It's worth noting that, on some keyboards, the Break key isn't available. Therefore, in such cases, a thread dump can be captured using the CTRL, SHIFT, and Pause keys together.

How do you debug a thread dump?

Depending on the issue, ignore internal JVM processing (for instance GC) Focus on long-running or blocked threads when issuing abnormal CPU or memory usage. Correlate the thread's stack with CPU processing by using top -H -p PID. And most importantly, use Analyzer tools.

How is Java thread dump useful?

A thread dump reveals information about an application's thread activity that can help you diagnose problems and better optimize application and JVM performance; for example, thread dumps automatically show the occurrence of a deadlock. Deadlocks bring some or all of an application to a complete halt.


1 Answers

I have written a tool to do what I wanted.

Java Thread Dump Analysis Tool

like image 60
mchr Avatar answered Sep 28 '22 02:09

mchr