Introduction to JVM monitoring tools

Source: Internet
Author: User
Tags jconsole

JVM Introduction to Monitoring Tools

VISUALVM is a visual tool that integrates multiple JDK command-line tools to provide you with powerful analytical capabilities. All of this is free! The command-line tools It includes are jps,jstat,jmap,jinfo,jstack,jconsole, which are consistent with the standard version of the JDK.

JPS: Similar to PS on UNIX, used to show the local Java process, you can view the local running a few Java programs, and display their process number.

Jstat: A very strong monitoring VM memory tool. can be used to monitor the size of various heap and non-heap sizes and their memory usage within VM memory.

Jmap: Prints out the case of a Java process (using PID) in memory, all ' objects ' (e.g., the number of objects that were produced).

Jinfo: This JVM monitoring tool can output and modify the opts of the Java process at runtime.

JSATCK: If a Java program crashes generating a core file, the Jstack tool can be used to obtain javastack and nativestack information for the core file, making it easy to know how the Java program crashes and where the problem occurs in the program.

Jconsole: A Javagui monitoring tool that can display a variety of data in a tabular format. Remote server VMS can be monitored through remote connections.

JVM detailed description of the monitoring tool:

1) JPS Tools:

Similar to the PS command in UNIX systems, the function is to display the current system's Java process and its ID number. Several Java processes can be viewed through JPS (because each Java program will monopolize a Java Virtual machine instance), and their process number (to be prepared for the following programs), and opt can be used to view detailed startup parameters for those processes.

How to use: Play JPS under the current command line (need java_home, no words, to the directory to change the program to play)

2) Jstat Tools:

The Jstat tool is particularly powerful and has a number of options to view in detail the usage of each part of the heap, as well as the number of loaded classes. When used, add the process ID of the viewing process and the selected parameters. The meanings of each parameter are described in detail below.

http://blog.csdn.net/zhaozheng7758/article/details/8623549

Jstat-class PID: Displays the number of loaded classes, and the amount of space that is occupied.

Jstat-compiler PID: Displays information such as the number of real-time VMS compiled.

JSTAT–GC PID: can display GC information, view GC number of times, and time. The last five items were YOUNGGC, YOUNGGC, FULLGC, FULLGC time, GC total time.

JSTAT–GC Capacity: You can display the use and occupancy of three generation (Young,old,perm) objects in VM memory, such as: Pgcmn shows the memory usage of the smallest perm, PGCMX shows the maximum memory usage of perm, The PGC is the current newly generated perm memory footprint, and the PC is but the pre-perm memory footprint. The other can be based on this analogy, OC is the old inside the pure consumption.

Jstat-gcnew the information for the Pid:new object.
Jstat-gcnewcapacity the information of the Pid:new object and its consumption.
Jstat-gcold the information for the Pid:old object.
Jstat-gcoldcapacity the information of the Pid:old object and its consumption.
Jstat-gcpermcapacity the information of the Pid:perm object and its consumption.
Jstat-gcutil PID: Statistical GC information statistics.
Jstat–printcompilation PID: Information for the current VM execution.
In addition to one of the above parameters, you can also add two numbers at a time, such as:

Jstat-printcompilation 3024 250 6 is printed every 250 milliseconds, printing a total of 6 times, plus-h3 every three lines to display the title.

3) Jmap Tools:

is a tool that can output all in-memory objects and can output the heap in a VM to text in binary.

Use the method Jmap-histopid. If you use Shelljmap-histopid>a.log to save it to text, after a while, using the text Comparison tool, you can compare which objects the GC recycles. The jmap-dump:format=b,file=string3024 can output a 3024-process memory heap to a string file.

4) Jinfo Tools:

Can output and modify runtime parameters of the Java process. Use the method Jmap-histo pid. If you use the SHELL jmap-histo Pid>a.log to save it to text (which is also available under Windows), after a while, using the text Comparison tool, you can compare which objects the GC recycles. JMAP-DUMP:FORMAT=B,FILE=F1 3024 can output the 3024 process memory heap to the F1 file.

5) Jstack Tools:

You can observe the current status of all threads in the JVM and the current state of the thread
Jstack 2083

6) Jconsole Tools:

Is a Java-written GUI program for monitoring VMS and monitoring remote VMS, very easy to use, and very powerful. Because it is a GUI program, there is no place to refer to Sun's official documentation.
How to use: Command line to play Jconsole, select the process is OK. http://swiftlet.net/archives/658

Reference for use: http://jiajun.iteye.com/blog/810150

Reference for use: http://blog.csdn.net/arkblue/article/details/6229637

Introduction to JVM monitoring tools

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.