VM performance monitoring and troubleshooting tool for notes (a)

Source: "in-depth understanding of the Java Virtual Machine," Zhou Zhiming forward

Table 1

name main role
jps JVM Process Status Tool displays all the Hotspot virtual machine process within the specified system
jstat JVM Statistics Monitoring Tool operating data for the collection of all aspects of HotSpot Virtual Machine
jinfo Configuration Info for java virtual machine configuration information display
jmap Memory Map for Java virtual machine generation
Jht Jvm Heap Dump Browser for analysis heapdump file, it will create a HTTP / HTML server, so that users can view the results in a browser
jstack Stack Trace for java threads show snapshots of virtual machines

Table 1 describes the command-line about the main monitoring tool.
Here began eleven details:

jps: VM process status tool

Function:
to list the virtual machines running processes and displays the virtual machine executes the main class ( Main Class, mainclass function resides) names, and these processes in the local virtual machine unique ID. And for local virtual machine, the LVMIDoperating system process ID is the same.

jpsFormat:

jps [options] [hostid]
Apply example:
Here Insert Picture Description
jps you can query the remote virtual machine process open state RMI services via RMI protocol, hostidregistered in the RMI registry host name of
jpsthe main tools of the options
Table 2

Options (option) effect
-q Output only LVMID, Zhu Lei name is omitted
-m When the output parameters passed to the virtual machine process starts master class main () function
-l The full name of the output of the master class, if the process is performed jar package jar package path output
-v JVM parameters of the virtual machine process starts output

jstat: Virtual Machine statistics monitoring tool

function:

Command is used to monitor virtual machines running various status information line tool, to display local or remote VMs in the process of class loading, memory, garbage collection, JIT compiler and other operating data.

jstatFormat:

jstat [option vmid [interval[slms][count]]

if local virtual machine -> VMIDwith the LVMIDsame

else VMIDformat:[protocol:][//]lvmid[@hostname[:port]/servername]

Parameters interval and represents the query interval and count the number of times, if you omit both parameters, indicating that only one query

Assuming that once every 250 milliseconds query garbage collection process 2764 case, a query 20 times:

jstat -gc 2764 250 20

jstatThe main tool of the options:

Options effect
-class Monitoring class loading, unloading amount of total space, and the time it takes to load the class
-gc Java heap monitor the situation, including the Eden area, two suvivor district, the old era, such as permanent-generation capacity, used space, GC total time information
-gccapacity Monitor the content and -gc basically the same, but the output is mainly concerned about the java heap to each region using the maximum, minimum space
-gcutil Monitor the content and -gc basically the same, but the output has been focused on the use of the percentage of total space
-gcnew GC monitors the status of the new generation
-gcnewcapacity Monitor the content and -gcnew basically the same, using the output of major concern to the maximum, minimum space
-gccause Consistent with the function -gcutil, but will cause additional output generated by the last GC
-gcold GC old's condition monitoring
-gcoldcapacity Monitor the content and -gcold basically the same, using the output of major concern to the maximum, minimum space
-gcpermcapacity Substituting the maximum and minimum output space permanent use
-compiler JIT compiler output compiled method, time-consuming and other information
-printcompilation Output has been JIT compiled methods

jinfo: Java configuration tool

function:

Real-time view and adjust the parameters of the virtual machine

jinfoFormat:

jinfo [option] pid

jmap: Java memory image tool

function:

For generating a snapshot heap dump (dump file or generally referred heapdump), finalize the query execution queue, java stack and permanent generation details, such as the utilization of space, which is currently used collector.

(Violence get :-XX:HeapDumpOnOutOfMemoryErrorautomatically generated dump file that allows virtual machines OOM anomaly appears, -XX:+HeapDumpOnCtrlBreakby using the [ctrl]+[break]generated dump file key)

jmap command format:

jmap [option] vmid

jmapTools main options

Options effect
-dump Generate Java heap dump snapshot. The format is: -dump:[live,]fomat=b,file=<filename>which live only dump sub-parameters indicate whether the live objects
-finalizerinfo Wait for the display object to perform finalize method Finalizer thread in the F-Queue. Download only valid under Linux, Solaris platforms
-heap Java stack display details, such as the recovery of which use parameter settings, generational status, etc., is only effective in the linux / Solaris
-histo Heap display statistics, including the class, the number of instances, aggregate capacity
-permstat ClassLoader is to show statistical permanent memory on behalf of the state. Only valid under Linux / Solaris platforms
-F When the virtual machine process -dump option of not responding, you can use this option to force a dump snapshot only in Linux / Solaris

jhat: A snapshot of the virtual machine heap dump analysis tool

function:

And jmapin combination, to analyze jmapheap dumps generated snapshots, you can view the results in a browser.
But generally will not use it to analyze:

  • Direct analysis of the dump file on the server does not deploy the application, the analytical work is time-consuming and consumes hardware resources
  • jhatThe analysis is relatively simple
    so I do not emphatically explained.

jhat: A snapshot of the virtual machine heap dump analysis tool

function:

And jmapin combination, to analyze jmapheap dumps generated snapshots

jstack: Java stack trace tool

function:

Threads for generating virtual machine snapshot of the current time (generally referred to threaddumpor javacore), is a collection of threads snapshot method within the current virtual machine each executing thread stack snapshot is generated because the thread locate the thread appears a long pause.

jstackFormat:

jstack [option] vmid

jstackTools main options

Options effect
-F When the request is not a normal response to the output, forced output thread stack
-l In addition to the stack, display additional information about locks
-m If the call to the local method, you can display the C / C ++ stack
Published 19 original articles · won praise 3 · Views 3821

Guess you like

Origin blog.csdn.net/weixin_42792088/article/details/100150082