A thread dump allows you to see a snapshot of what Artifactory was doing at the time the thread dump was carried out. This can be very helpful if you’re engaged in performance troubleshooting. A Java thread dump analyzer (such as fastThread) tool can make it easy to read, compare, and analyze multiple thread dumps.
Artifactory can generate multiple thread dumps from its Support Bundle, but other options exist, as well. Regardless of how it’s accomplished, it’s important to make sure that your thread dumps are being generated during times when problems are occurring. Additionally, if thread dumps are executed too close to one another, there may be too much noise, which will make it difficult for you to discover useful information. Equally, executing them too far apart could potentially cause you to miss vital data. To obtain useful data, a good rule of thumb is to execute five (5), consecutive thread dumps, each 10 seconds apart from the other.
Thereafter, upload your files to a thread analyzer tool such as fastThread, a Java thread dump analyzer. Be aware that it may take a while for the tool to parse analyze your thread dumps. Upon completion, you’ll be provided an analytical summary of your threads, as follows:
Thread Information
- Thread name: When using the Java.lang.Thread class to generate a thread, the thread will be named Thread-(Number). When using the java.util.concurrent.ThreadFactory class, the thread will be named pool-(number)-thread-(number).
- Priority: This represents the numeric priority of the Java thread.
- Thread ID: This represents the unique ID for the threads. This can provide some useful information, including the CPU and/or memory usage of the thread.)
- Thread Status: A human-readable string describing the current status of the thread.
- Thread Callstack: This represents the stack trace information of the threads.
Thread States:
- New: This is a thread that has been created, but has yet to be processed.
- Runnable: This shows that a thread is occupying CPU space and processing a task. (It may be in waiting status due to how your OS distributes its resources.)
- Blocked: This is a thread that’s waiting for a different thread to release its lock in order to get the monitor lock.
- Waiting: This is a thread that’s waiting using the wait, join or park method.
- Timed_Waiting: This is a thread that’s waiting using the sleep, wait, join, or park method. (The difference between Waiting and Timed_Waiting is that the WAITING waits indefinitely while TIMED_WAITING waits for up to a specified waiting time)
Note: If any given thread dump is too large for your thread analyzer, the following Linux command will be useful for splitting the file by size:
split -b <file size> <thread dump file> <segment file>
For example: If you have a 140k thread dump named myfile and you execute the following command:
split -b 40k myfile segment
This will output four, 40KB files: segmentaa, segmentab, segmentac, and segmentad
More information on analyzing Java thread dumps is available HERE.