How to take thread dump

A thread dump will help a developer to identify the application hanging issues and performance issues. To analyze this, please take, a continuous snapshot of thread dumps and analyze using a thread dump analyzing tool.

In Oracle Java you can use jstack tool. This executable is available in the JAVA_HOME/bin folder. Use the following command ‘ jstack -l <PID> >> threaddump ‘ .

This will write the thread dump into a file ‘threaddump’ in the directory from you have executed the command.

<PID> should replaced with actual process id. You can use the following command to find the process id in Unix. ‘ ps -ef | grep java ‘ .

In IBM Java you can use ‘ kill -3 <PID> ‘ .

This will write the thread dump in application running console or in nohup file or a thread dump file will be generated in the program running directory.

Leave a Reply

Your email address will not be published. Required fields are marked *