7

Do you know some good thread dump analyzer tool? Perfect would be :

  • free
  • can read a few thread dumps and compare them
  • point out which threads took the longest, what are the classes that the thread is locked on etc.
  • shows threads, locks, deadlocks and multiple threads waiting to acquire a single lock

Edit:

  • offline analyze - load file with one or many thread dump and analyze it.

Edit: My choice is: Samurai. It has all the features I need: Loads logfile, and compares few thread dumps. Analyze it and points:

  • waiting threads
  • blocked threads
  • blocking threads
  • deadlock

I'll leave question as answered because TDA is the best answer that was given.

Daniel Serodio
  • 4,229
  • 5
  • 37
  • 33
Augustin Ghauratto
  • 1,420
  • 1
  • 19
  • 21
  • i found the spotify thread dump analyzer helpful http://spotify.github.io/threaddump-analyzer/ – Chris Feb 25 '15 at 16:44

3 Answers3

7

You could use TDA - Thread Dump Analyser, a plug-in for Visual VM.

Visual VM is free as well. I think this is your best choice.

If you are on Linux you could use kill -3 to get a thread dump and look for deadlocks using using Thread Dump Analyzer.

VisualVM now ships as part of the JDK and can be used monitor memory usage, threads and also includes a profiler.

jmap can be used to obtain heap histograms and heap dumps from Java processes. You could then use a tool like Eclipse Memory Analyzer to investigate it.

As another answer mentioned you could look into JMX and JConsole. For each service in our application we have a MBean so we can view keys stats such as queue sizes to check if anything seems out of the ordinary.

From Tools and tips for Sun JVM troubleshooting on ServerFault.

Community
  • 1
  • 1
Shamis Shukoor
  • 2,515
  • 5
  • 29
  • 33
  • 1
    As far as I see, in visualvm I cannot do offline analize. Did I missed something? In my case I cannot connect analizer to running instance. – Augustin Ghauratto Nov 18 '12 at 07:16
  • @AugustinGhauratto how are planning to get the threads without connecting to the running instance ? – Shamis Shukoor Nov 18 '12 at 20:15
  • On linux: kill -3 java_instance_pid , generates thread dump to console log. I cannot afford to give an instance with heavy load more burden. And I don't have physical possibility to do so - sshd has forwarding disabled, and visualvm as far as I did investigate it is graphical tool. – Augustin Ghauratto Nov 26 '12 at 08:24
  • Any advice on how to install this on VisualVM/JDK 1.8.0_144 (and in other newer versions, I suspect)? It doesn't appear in the [plugin update listings](https://visualvm.github.io/pluginscenters.html). The wiki [recommends to download it manually](https://github.com/irockel/tda/wiki/12.-VisualVM-Plugin#wiki-body) from the "TDA website", but [the site](https://tda.dev.java.net/) seems to be long gone... And there are no release artifacts in the [GitHub releases page](https://github.com/irockel/tda/releases/) either :( – Janaka Bandara Mar 14 '19 at 02:35
3

In case you use IBM JRE you should use IBM Thread and Monitor Dump Analyzer for Java, which offers exactly what you need (offline use, comparisons etc).

trikelef
  • 2,192
  • 1
  • 22
  • 39
0

You could try my Dump Analyzer. I had the same need and developed my own dump analyzer. It has some of the features of your list.

  • 1
    I don't understand why should be a comment, my answer is like the rest of answers... every answer is offering an app for analyzing threads dumps. By the way, the project is now on Github: [https://github.com/sergiocormio/dump-analyzer](https://github.com/sergiocormio/dump-analyzer) – user3490698 Mar 15 '17 at 20:18