In many cases, the word dump will appear, and the Java Virtual Machine JVM is no exception, including memory dump, thread dump.
When an application memory overflow or high memory usage is found, the reason can be found through memory dump analysis.
When the CPU usage is found to be high, the thread dump is used to locate which thread is taking too much resources.
First, memory dump refers to files that are output through Jmap-dump <pid>, while thread dump refers to the information that is output through Jstack <pid>.
Two dump can be used alone or in combination with a specific occasion.
Under the Linux operating system (JDK installed), execute the JPS command, listing the process ID of the running Java program.
Use top to see how the currently running process is using system resources.
The process with process number 24660, which appears in the JPS output list and the top list, is displayed in the top list and is started by the Java command.
Where%mem is 2.9, indicating that the system memory is 2.9%, the current system is about 8G of memory, and the other%cpu refers to the current process using CPU resources percentage;
"Memory Dump"
Jmap–dump:live,format=b,file=heap.bin <pid>
Reference: http://docs.oracle.com/javase/6/docs/technotes/tools/share/jmap.html
The Heap.bin file will be generated using the Ha456.jar tool to open the analysis. java-jar-xmx3000m Ha456.jar
"Thread Dump"
Jstack-m <pid> >jvm_deadlocks.txt
Jstack-l <pid> >jvm_listlocks.txt
Reference http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstack.html
Use Top-h-P <pid> to find the thread ID to parse in a process and then convert the thread ID to 16 to search for relevant information in the inline dump file
Introduction and use of JVM dump (memory vs. threading)