Wednesday 7 August 2013

How will you take thread dump in Java? How will you analyze Thread dump?

 A Thread Dump is a complete list of active threads. A java thread dump is a way of finding out what each thread in the JVM is doing at a particular point of time. This is especially useful when your java application seems to have some performance issues. Thread dump will help you to find out which thread is causing this. There are several ways to take thread dumps from a JVM. It is highly recommended to take more than 1 thread dump and analyze the results based on it. Follow below steps to take thread dump of a java process

•Step 1

On UNIX, Linux and Mac OSX Environment run below command:

ps -el | grep java

On Windows:

Press Ctrl+Shift+Esc to open the task manager and find the PID of the java process

•Step 2:

Use jstack command to print the Java stack traces for a given Java process PID

jstack [PID]

1 comment:

Anonymous said...

I have tried a online tool for analyzing thread dumps. It parses all formats and excellent Java thread dump analyser