TDA - Thread Dump Analyzer - 2.1
TDA - Thread Dump Analyzer - 2.1
Table of Contents
1. General ................................................................................................................................................ 1 1.1. Request Thread Dumps ................................................................................................................ 2 1.2. Thread Dump Parsing .................................................................................................................. 2 1.3. Regular Expression For Time Stamps .............................................................................................. 6 1.4. Using Filters ............................................................................................................................... 7 1.5. Using Categories ......................................................................................................................... 8 1.6. Deadlocks .................................................................................................................................. 8 1.7. Sessions .................................................................................................................................... 9 1.8. Long Running Threads ................................................................................................................. 9 1.9. Heavy Load Analysis ................................................................................................................. 10 1.10. JConsole Plugin ...................................................................................................................... 10 1.11. VisualVM Plugin ..................................................................................................................... 11 2. Analyzing production environments ........................................................................................................ 13 2.1. Dumping Information about running threads ................................................................................... 13 2.2. Long running thread detection on Solaris ....................................................................................... 15 2.3. Analyzing the heap profile .......................................................................................................... 15 3. Application Analysis using JConsole ....................................................................................................... 16 3.1. Remote application access ........................................................................................................... 16 3.2. Requesting Dumps .................................................................................................................... 16 3.3. Plugins For JConsole ................................................................................................................. 16 A. References ......................................................................................................................................... 17
iii
List of Figures
1.1. Welcome Screen ................................................................................................................................. 1 1.2. Information about the selected dump ....................................................................................................... 3 1.3. Thread Dump View ............................................................................................................................. 4 1.4. Monitors used by threads ...................................................................................................................... 5 1.5. Class Histogram of selected dump .......................................................................................................... 6 1.6. A filter filtering jgroups threads ............................................................................................................. 7 1.7. A Custom Category ............................................................................................................................. 8 1.8. Long running threads detection .............................................................................................................. 9 1.9. TDA JConsole Plugin ........................................................................................................................ 11 1.10. TDA VisualVM Plugin ..................................................................................................................... 12 2.1. TDA giving hints about selected dump .................................................................................................. 14 2.2. Long running threads detection ............................................................................................................ 15
iv
1
General
This chapter gives an introduction on how to use the TDA - Thread Dump Analyzer. TDA parses your log files and displays all found thread dumps and class histograms reported from a Sun JVM 1.4.x or better, SAP VM or HP-UX VM. Class Histograms are not included in the thread dumps by default but need a special JVM-Flag to be dumped with the thread dump (see below). As TDA does everything offline and thread dumps have very low impact on the VM (including the class histogram option), it can be used for production environments.
General
General
General
General
IMPORTANT
There is a bug in early 1.5.x releases preventing the class histogram to be printed if any other than the concurrent mark sweep garbage collector is used.
General
General
06/02/14 14:54:04
at java.lang.Thread.run(Thread.java:534)
TDA takes the first capturing group of the expression as time stamp. In this example the \d is for digits and the capturing group is included in the brackets and matches <i>06/02/14 14:54:04</i> . This is stored as timestamp for the next thread dump. Starting with JDK 1.6 the SUN JDKs print out a time stamp in the line before the dump. There is a default regular expression which recognizes this time stamp. If the timestamp is stored in milliseconds since 1970 there is a checkbox in the preferences Parsed timestamp is a long representing msecs since 1970 to tell TDA to convert the parsed time stamp from milliseconds into a human readable time stamp. See References for detailed information about the regular expressions in java.
General
if org.jgroups is in the stack information of a thread. If a specified filter should be applied to all displayed categories, the Default checkbox needs to be checked. Filters which aren't applied to all categories can be used in custom categories.
1.6. Deadlocks
If the JVM finds a java level deadlock in your application it logs this into the thread dump. This information will be displayed in the deadlock node of the dump. There is also a hint concerning the found deadlock(s) in the dump summary. Note though, it doesn't have any deadlock detection for java level deadlocks itself, it relies on the deadlock detection of the VM. TDA also tries to find deadlocks which might be caused by some external resources or some remote communication and can't 8
General
be found by the Java VM. If there are indication for such a deadlock, TDA will display information concerning this in the dump summury and gives you hints what to do next.
1.7. Sessions
If you opened several logfiles and you want to quit TDA and go back to this logfiles later, you can store the open logfiles to a session file. The logfile tree then is dumped into a session file for later usage. You must keep the logfiles if you want to be able to browse them again. For the tree navigation they are not necessary. Note that session are only supported for one version of TDA, they are not exchangeable between different versions.
General
HINT
The long running threads detection is a bit picky about the selected nodes for the detection. You should only select thread dump root nodes otherwise the detection might through an exception as it doesn't know what to do with the selected nodes. You also always should select nodes from one VM run, otherwise you might get quite weird results because the detection matched threads from different VM runs.
10
General
https://visualvm.dev.java.net
11
General
12
2
Analyzing production environments
Starting with Sun's JDK 1.5 it is quite easy to get information about a badly behaving application in a production environment using the JVM tools jmap and jstack. Jmap fetches a heap dump from the VM the application is running in and jstack fetches the thread dumps. These information can be taken from the server the application server is running on and analyzed offline. Even without remote access to the server you still can get these dumps from your customer. Many Monitoring tools usually need some kind of remote access. Imagine a customer's web application with a lot of concurrent users accessing the system and the system is under heavy load. The system is only accessed during office hours. But you have noticed the load of the system stays high in the night although nobody is accessing it. What can you do?
for the additional dumps. You then can use the TDA - Thread Dump Analyzer to analyze the thread dumps to get an idea what is currently happening in your application. TDA will try to give you some hints about what might be wrong in the dumps (e.g. a lot of threads are waiting for the garbage collector) like in the screenshot below.
13
14
15
3
Application Analysis using JConsole
With JDK 1.5 Sun introduced JConsole, a swing based tool for instrumentalizing the new JMX MBeans for VM analysis in 1.5 and to provide easy remote access to all other JMX MBeans offered (e.g. by the application server or an application). With the release of JDK 1.6 Sun enhanced the utility to also support plugins and simplified access to the applications to analyze. With JConsole it is quite easy to do some application analysis without critical impact on the application.
16
Appendix A. References
i. GC-Viewer ii. VisualVM
3 2 1
iii JConsole . 4 iv Java API Specification 1.4.2 (for regular expressions look for Pattern class.) . 5 v. SendSignal vi Dumpster (my blog) .
6
1 2
17