Thread Dump Analyzer



    Sometimes, on Java we can’t trace or profile since instrumentation would take too long, so then thread dumps seem an appropriate tool.  This article is partially based on Pierre’s course[2] and Confluence Support [4].

   Although not a tracing technique, using this tool is possible to do a sampling recording, getting a set of snapshots with the same delay.

Thread Dump Basic

    Well, the dump itself is an execution snapshot of the threads created in Java. The skill to differentiate the threads you care is something to be developed and can be partially solved using the tools – that I talk below.  It is indeed a collection of stack trees. The threads have basically 6 states [4]:

  • NEW

Thread Dump Generation

       It’s possible to use JPS to find the applications running Java. 

        1 – kill -3 [pid] –> signal to the process to tomcat

        2 – Jstack command                      

        3 – Java Visual VM [5]

                     Very visual method but we can see the live threads on the console.

        4 – Console – dump straight from the console 

Thread Dump Analysis

        It is technically a screenshot of the threads. It will bring info and several tools can be used to analyze it, though it’s possible to analyze straight from the file, which highlights some details the on the file.

       Don’t analyze all the threads but rather try to find a pattern from a few patterns, with locked threads and all this. This type of analysis can show Heat Depletion [3], in which Pierre-Hugues describes a Thread Dump analysis only using txt analysis.

TDA Tools

   But the manual analysis will become difficult, either because is long or is complex threads, blocked threads, and deadlocked threads are easier to find using a TDA tool, like TDA or Samurai.

Thread Dump Analyzer

      The so-called TDA is an analyzer, is a visualization tool that is used after having the log data using jstack utility, which is part of the JDK not the JRE. 

     Then you can run TDA using  java -jar tda.jar

     We can see then the threads using the visualization tool.

Other tools

     The article [1] compares in some aspects Samurai and TDA tool, according to the author, John Mazzitelli, Samurai loses points by the threads names but appreciated the grouping mechanism used that combines threads with a similar state.







Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s