JDK with VM analysis tool jps|jstat|jmap|jconsole using __JS

Source: Internet
Author: User
Tags memory usage jconsole
I. Overview

Several of the monitoring tools available in the Oracle jdk are very useful. The following is a brief introduction to these kinds of tools. (Note: These tools are integrated in the above version of the JDK5.0, not specially installed, the path in the $java_home/bin/directory)



JPS is similar to the PS on UNIX, used to display local Java processes, to view several Java programs running locally and to display their process numbers. Jstat a very strong monitoring VM memory tool.    can be used to monitor the size and memory usage of various heaps and heaps within the VM's memory.    Jmap prints out the case of all ' objects ' in memory of a Java process (using PID) (e.g., the resulting objects, and their number). Jconsole A Java GUI monitoring tool that displays a variety of data in a graphical format. Remote connections can be used to monitor the server VM remotely.

Second, the use of the introduction
1, JPS

Many people have used the PS command in UNIX systems, which is mainly used to show the current system process, what processes, and their IDs. JPS is also the same, its role is to display the current system Java process situation, and its ID number. We can use it to see how many Java processes we have started (because each Java program will monopolize a Java Virtual machine instance), and their process number (to prepare for the following programs), and opt to view the detailed startup parameters for those processes.


2, Jstat
Jstat monitors the VM memory usage, the Jstat tool is particularly powerful, with numerous options for detailed viewing of the amount of usage in each part of the heap and the number of classes loaded. When used, you need to add the process ID of the view process, and the selected parameters. The meaning of each parameter is described in detail below.
Jstat-class PID: Displays the number of loaded classes, and the amount of space to occupy information.
Jstat-compiler PID: Displays information such as the number of real-time VM compilations.
JSTAT-GC PID: You can display GC information, view the number of GC, and time. The last five items were the number of young GC, the time of young GC, the number of full GC, the time of full GC, and the total time of GC.
Jstat-gccapacity: Can show the use and occupancy of three generations (Young,old,perm) objects in VM memory, such as: PGCMN Displays the minimum perm memory usage, PGCMX displays the maximum amount of memory used by Perm. PGC is currently the newly generated perm memory footprint, and the PC is but the previous perm memory footprint. Other can be based on this analogy, OC is the pure amount of old.
Jstat-gcnew the Pid:new object's information.
Jstat-gcnewcapacity the information of the Pid:new object and the amount it occupies.
Jstat-gcold the Pid:old object's information.
Jstat-gcoldcapacity the information of the Pid:old object and the amount it occupies.
Jstat-gcpermcapacity the information of the Pid:perm object and the amount it occupies.
Jstat-util PID: Statistical GC information statistics.
Jstat-printcompilation PID: Information about the current VM execution.

In addition to one of the above parameters, you can also add two digits, such as: Jstat-printcompilation 3024 250 6 is printed every 250 milliseconds, printing 6 times, but also add-h3 every three lines to show the title.


3, Jmap

Jmap is a tool that can output all in-memory objects, and can even output heap from a VM to binary text. 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 period of time, you can compare which objects the GC reclaims by using the text Contrast tool.

Jmap-dump:format=b,file=heap.bin <pid>

The memory heap of the 3024 process can be exported to the F1 file.

The generated dump file can be viewed through Memory Analyzer analytics, URL: http://www.eclipse.org/mat/, you can view the number of objects in the dump, memory footprint, threading, and so on.


4, Jconsole
Jconsole is a Java-written GUI program used to monitor VMS and monitor remote VMS for ease of use, and very powerful. Since it is a GUI program, this is not detailed here, and it is not possible to refer to Oracle's official documentation.
How to use: Jconsole in the command line, select the process on it.


Reference http://docs.oracle.com/javase/7/docs/technotes/tools/share/jps.html
Http://docs.oracle.com/javase/7/docs/technotes/tools/share/jstat.html
Http://docs.oracle.com/javase/7/docs/technotes/tools/share/jmap.html

Http://docs.oracle.com/javase/7/docs/technotes/tools/share/jconsole.html







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.