[Java Basics] using Jmap dump and analysis dump file

Source: Internet
Author: User
Tags visualvm

Reprint: http://blog.csdn.net/kevin_luan/article/details/8447896

http://liulinxia02.blog.163.com/blog/static/26868772009111861834942/

http://zhumeng8337797.blog.163.com/blog/static/100768914201242410583187/

Where Jmap is the tool that comes with Java

View entire JVM memory status
JMAP-HEAP [PID]
It is important to note that in the case of CMS GC, the execution of jmap-heap may cause the Java process to hang

Viewing object detail usage in the JVM heap
Jmap-histo [PID]

Exporting memory information throughout the JVM
jmap-dump:format=b,file= file name [PID]

Jhat is a tool for analyzing JVM heap dump files in Sun 1.6 and later, and is based on this tool to analyze memory consumption of objects in the JVM heap
jhat-j-xmx1024m [File]
Wait for the console to enter start HTTP server on port 7000 to use the browser to access ip:7000

Eclipse Memory Analyzer
An Eclipse provides a plug-in for parsing JVM heap dump files. This plugin allows you to see the memory footprint of an object, reference relationships, analyze memory leaks, and more.
http://www.eclipse.org/mat/


kill-3 [PID]
To find the process number of Java on Linux and execute the above command, the information about the thread is output to the console


Jstack
Jstack is the Sun JDK's own tool that lets you see the health of threads in the JVM, including lock waits, whether the thread is running
Executes Jstack [PID], all stack information for the thread

"http-8080-10" daemon prio=10 tid=x0a949bb60 nid=0x884 waiting for monitor entry [...]

The thread "http-8080-10" is in a waiting state. Waiting for monitor entry if the output thread stack information is present on the same or multiple threads in a row, then there is a lock in the system that is fiercely competitive, deadlocked, or locked in the imagination of starvation.


"http-8080-11" daemon prio=10 tix=xxx nid=xxx in object.wait () [...]
Java.lang.Thread.State:waiting (on object monitor)
This indicates that the thread of the http-8080-11 is on the wait for the object and waits for another thread to wake up, which is a common use of the thread pool.

"Low Memory Detector" daemon prio=10 tix=xx nid=xxx runnable [...] java.lang.Thread.State:runnable
The thread that represents "low Memory Detector" is in the runable state, waiting for the CPU to be available for use.

Reference: http://zhumeng8337797.blog.163.com/blog/static/100768914201242410583187/

Jvisualvm

I. Java VisualVM Overview

It is too cumbersome to remotely monitor the JVM using the command line. Oracle provides a new visualization in jdk1.6. JVM monitoring Tool Java VisualVM. The Jvisualvm.exe is in the bin directory of the JDK.

When you double-click Start Java VisualVM, you can see the "local", "Remote", "snapshot" three items in the "Application" bar on the left side of the window.

"Local" shows the resource consumption of Java programs running on localhost, if a Java program is running, start Java VisualVM can see the corresponding program name, click on the program name to open the appropriate resource Monitoring menu, graphically list the program occupied by the CP Statistics for U, Heap, PermGen, class, Thread.

"Remote" entry for the resource usage of the Java program on the remote host, but need to run the JSTATD daemon on the remote host

The VISUALVM is divided into 3 classes, which are automatically detected and displayed locally.

Double click on any node under local, see the change on the right, you can monitor the CPU, memory, class, thread and other health, real-time monitoring server performance.

Right click VISUALVM we can see Thread dump, Heap dump

Do Thread Dump, and soon you'll see the results.

Heap dump takes a little time (you can see the number of objects in the heap and the proportions that are used to make OOM very useful)

The function is no longer described, you can check the quality of the online, we mainly talk about how to use VisualVM remote monitoring.

[Java Basics] using Jmap dump and analysis dump file

Related Article

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.