Introduction and use of JVM dump (memory vs. threading)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.