java thread dump analysis tool java program performance analysis thread dump and heap dump

jstack and thread dump analysis 

Thread dump and heap dump for java program performance analysis

1. [Memory dump]

jmap –dump:live,format=b,file=heap.bin <pid>

2. [Thread dump]

jstack is a stack trace tool that comes with the Java virtual machine.

 basic introduction:

 jstack is used to generate a thread snapshot of the current moment of the java virtual machine. A thread snapshot is a collection of method stacks that are being executed by each thread in the current Java virtual machine. The main purpose of generating a thread snapshot is to locate the cause of the thread's long pause, such as inter-thread deadlock, infinite loop, and long time caused by requesting external resources. Time to wait and so on.

When the thread is paused, you can view the call stack of each thread through jstack, and you can know what the unresponsive thread is doing in the background, or what resources it is waiting for.

Command format:

jstack [ option ] pid
Basic parameters:
-F Force stack information to be printed when 'jstack [-l] pid' has no corresponding
-l long list. Print additional information about locks, such as a list of ownable synchronizers belonging to java.util.concurrent.
-m prints all stack information for java and native c/c++ frameworks. -h | -help prints help information
 
 
If the program runs normally: jstack [-l] pid > xxx.log Input thread information to the specified file 
If the program is unresponsive: jstack -F [-m] [-l] pid >xxx.log Force printing of stack information 
                            top -H -p pid to find out the thread pid with high CPU usage (or long execution time) 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325499499&siteId=291194637