Thread dump files tend to span for several hundreds of lines (sometimes a few thousands of lines). It is hard to conceive and assimilate all the information in the thread dump due to its verbosity. Flame Graph generated by fastThread tool condenses all the information into one single compact flame graph format. It facilitates you to identify hot code paths quickly. In this article, let us learn how to use flame graphs generated by fastThread tool for effective debugging/troubleshooting purposes.

If you would like to learn how to generate flame graph from java thread dumps, you can refer to this article

fastThread Flame graph features

Here are key features of the flame graph generated by fastThread application:

1. Information on Mouse Hover: 

Stack traces are represented as a column of boxes, where each box represents a function (a stack frame). On mouse-over of boxes, a tooltip will be displayed. It will show the class name, method name, and line of the code that has been executed. More importantly, it will show the number of threads that are executing this line of code.

Example: 

com.buggycompany.framework.concurrent.buyggycompanyCallable.call(buggycompanyCallable.java:82), thread count: 2467)

Fig: Hovering mouse generates tool tip indicating line of code that is executed

2. Flame Graph Color

The background color for each box is not significant and is picked at random to be a warm hue. This randomness helps the eye to differentiate boxes, especially for adjacent thin “towers”.

3. Box width

The width of each box depends on the thread count. If the width of the box is sufficient, it displays the full function name. If not, either a truncated function name with an ellipsis is shown, or nothing.

4. Click to zoom

When a box is clicked, the flame graph zooms horizontally. This reveals more detail and often function names for the child functions. 

Fig: Clicking on the boxes, will zoom the Flame graph

Once you have zoomed in and if you would like to zoom out back to original graph, you can click on the ‘Reset zoom’ at the top right corner in the graph.

Fig: Clicking on ‘Reset zoom’ will take you back to original Flame graph

5. Search

All function names, class names, and package names present in the thread dump file can be searched. On the right top corner to the graph there is a search box as shown in the below image.

Fig: Search box in the Flame graph

In this search box, you can enter function name, class name, package name, or even line numbers present in the thread dump’s stack trace. Any matched boxes are highlighted with magenta backgrounds. Say if you are interested in searching only for your application code, you can enter your application package name (example: com.mycompany…..)

Fig: Matching text highlighted in the Flame graph

The sum of matched stack traces is also shown at the left- bottom of the Flame Graph, as shown in the above image. 

Conclusion

The flame graph is a powerful yet simple way to visualize and analyze your thread dumps. We hope it will be useful to debug your production problems.