Category:JVM
Article From:https://www.cnblogs.com/winner-0715/p/9127608.html

jstat(JVM Statistics Monitoring Tool)It is a command line tool used to monitor all kinds of running state information of virtual machines. It can display &lt in the local or remote virtual machine process; class loading, memory, garbage collection,
JITCompile > wait for running data, without a GUI graphical interface, and only provide a pure text console on the server. It is the first choice tool for running a virtual machine performance problem.

jstatUnder the bin directory of Java, the real-time command line monitoring of the resources and performance of the Java application is carried out with the instructions built in JVM, including the monitoring of Heap size and the status of garbage collection. Visible, Jstat is a lightweight, dedicated JVM worker.It is very suitable.

jstat Command format

jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]

Parameter interpretation:

Option — Options, we generally use -gcutil to view the GC situation

vmid — VMThe process number, the current running java process number

interval– A unit of time, a unit of a second or a millisecond

count — Number of printing times, innumerable prints if default

The parameters interval and count represent the interval and number of queries. If these two parameters are omitted, only one query is indicated. Suppose you need to query the process 5828 garbage collection status every 250 milliseconds for 5 times, then the command line is as follows:

jstat -gc 5828 250 5
VMID and LVMID need special instructions for the command format: if it is a local virtual machine process, VMID (Virtual Machine IDentifier, virtual machine identifier) and LVMID (Local Virtual Mach)Ine IDentifier,
The virtual machine identifier is consistent. If it is a remote virtual machine process, the format of VMID should be: [protocol:][//] lvmid [@hostname[:port]/servername]

option

The option option represents the virtual machine information that the user wants to query. It is divided into 3 categories: class loading, garbage collection, and runtime compilation. The specific options and functions are as follows:

class The time spent monitoring class loading, unload number, total space, and class loading - GC monitors the Java heap status, including the capacity of the Eden zone, 2 Survivor, old, permanent, and so on - gccapacity monitoring content is basically the same as -gc,
But the output focuses mainly on the maximum and minimum space used by the Java heap area - the gcutil monitoring content is basically the same as the -gc, but the output focuses on the percentage of the total space that has been used - gccause is the same as the -gcutil function, but the output will be extra
The cause of the last GC generation - gcnew monitoring the status of the Cenozoic GC - gcnewcapacity monitoring content is basically the same as -gcnew, and the output mainly focuses on the maximum and minimum space used - gcold monitoring the status of the older generation GC
–gcoldcapacity Monitoring content is basically the same as - gcold, the output is mainly concerned with the maximum and minimum space used - the maximum and minimum space used by the gcpermcapacity output permanently - the method compiled by the compiler output JIT compiler,
Time consuming information - printcompilation output has been compiled by JIT.

Common terms

1、jstat –class<pid> : Shows the number of loaded class and the space occupied.

Loaded The number of classes that are loaded with the number of Bytes loading classes, the number of bytes Unloaded unload classes, the number of bytes of the Bytes uninstall class, the time spent on loading and unloading classes, Time

2、jstat -compiler <pid>Display the amount of VM real-time compilation and other information.

Compiled Compiling task execution number Failed compilation task execution failure number Invalid compile task execution failure number Time compile task consumption time FailedType final Compile failure task type FailedMethod
The class and method of the latter compilation failure task

3、jstat -gc <pid>: You can display the information of GC, check the number and time of GC.

S0C The capacity (bytes) of the first survivor (surviving area) of the young generation (bytes) the capacity of second survivor (surviving areas) in the young generation (bytes) of the young generation (bytes) the first survivor (surviving area) of the young generation in the young generation of the young generation (bytes) has now used space (bytes).
S1U Second young generations of survivor (surviving zone) currently using space (bytes) EC in the young generation of Eden (Eden) capacity (bytes) EU young generation Eden (Yi Dianyuan) has now used space (bytes) OC Old generation capacity
(Bytes) OU Old generation now uses space (bytes) PC Perm (bytes) PU Perm (bytes) PU Perm (bytes) currently using space (bytes) YGC from application startup to sampling in young generation GC times YGCT fromapplication program
Startup to sampling time (s) FGC in young generation (s) FGC from application to sampling time (all GC) GC times FGCT from application startup to sampling time old generation (s) GC (s) GCT from application to samplingC
Total time (s)

4、jstat -gccapacity <pid>:You can show the usage and occupancy of the three generation (young, old, perm) objects in VM memory.

NGCMN The young generation (young) initializes (the smallest) size (bytes) NGCMX young generation (young) the maximum capacity (bytes) NGC young generation (young) the current capacity (byte) S0C of the first survivor in the young generation (lucky)Storage area)
Capacity (bytes) of the capacity (bytes) of the second survivor (bytes) of the young generation of the young generation (bytes) the capacity (bytes) of the Eden (Eden) of the young generation (bytes) in the young generation of the EC (bytes) the OGCMN old generation in the OGCMN old generation (minimum) size (bytes) OGCMXThe largest old generation
The capacity (bytes) of the current new generated capacity (bytes) the capacity (bytes) of the OC Old generation (bytes) the PGCMN perm generation in the PGCMN perm generation, the maximum capacity (bytes) of the size (bytes) of the PGCMX perm generation (bytes) of the PGCMN perm generation.PGC pERM generation of current newly generated capacity (bytes) PC Perm (byte) capacity (bytes) YGC from application startup to sampling of young generation GC times FGC from application start to sampling old generation (all GC) GC times

5、jstat -gcutil <pid>:Statistical GC information

S0 The first survivor (surviving area) of the young generation (surviving area) has been used by the percentage of current capacity S1 for second survivor (surviving areas) already used by the percentage of current capacity percentage E in the young generation Eden (Yi Dianyuan) already used to account for the current capacity.
The ratio of the O old generation accounts for the current capacity percentage P perm generation used to account for the current capacity percentage YGC from the application program to the sample when the young generation GC times YGCT starts from the application to the sampling time of the medium GC time (s) FGC (s) FGC.
The total time (s) for GC using the time (s) GCT (s) GCT (s) GCT from the application startup to sampling of the old generation (all GC) GC times FGCT from the application to sampling time (s) GCT from the application to sampling.

6、jstat -gcnew <pid>:The information of the young generation.

S0C The capacity (bytes) of the first survivor (surviving area) of the young generation (bytes) S1C the capacity of second survivor (surviving regions) in the young generation (bytes) the first survivor (surviving zone) of the young generation in the young generation of the young generation now uses space (bytes) S1U
Second young generations of survivor (surviving zone) currently using space (bytes) TT holding times limit MTT maximum holding times limit EC young generation Eden (Eden) capacity (bytes) EU in the young generation Eden (Yi Dianyuan) now alreadysend
Using space (byte) YGC to start from application to sampling, the number of GC times in the young generation is YGCT, the time from GC to the time of sampling in the younger generation (s).

7、jstat -gcnewcapacity<pid>: The information of the young generation and its amount.

NGCMN The initial (minimum) size (minimum) of the young generation (young) NGCMX young generation (young) the maximum capacity (bytes) of the NGC young generation (young) the current capacity (byte) S0CMX of the first survivor in the young generation(surviving area)
Maximum capacity (bytes) S0C young generation of the first survivor (surviving zone) capacity (bytes) the maximum capacity (bytes) of the maximum capacity (bytes) of the second survivor (bytes) in the young generation of the young generation (bytes) S1C in the young generation of the second survivor(surviving area)
Capacity (bytes) ECMX the maximum capacity (bytes) of the Eden (Eden) in the young generation of the young generation (bytes) the capacity (bytes) of the young generation of the young generation (Eden) in the young generation (bytes) YGC from the application program to the sample, when the young generation of GC times FGC is started from the application to the ECMX.kind
The times of old generation (all GC) GC

8、jstat -gcold <pid>:oldInformation on behalf of the object.

PC Perm(The capacity (bytes) PU Perm (protracted generation) currently using space (bytes) OC Old generation capacity (bytes) OU Old instead of using space (byte) YGC in the young generation of GC times when the YGC is started from the application to the sample.
FGC The total time (s) for GC using the time (s) GCT (s) GCT (s) GCT from the application startup to sampling of the old generation (all GC) GC times FGCT from the application to sampling time (s) GCT from the application to sampling.

9、stat -gcoldcapacity <pid>: oldThe information of the generation of objects and their amount.

OGCMN oldThe maximum capacity (bytes) of the size (bytes) OGCMX old generation (bytes) OGC old instead of the current newly generated capacity (bytes) OC Old generation capacity (bytes) YGC from application startup to sampling in young generation GC times
FGC The total time (s) for GC using the time (s) GCT (s) GCT (s) GCT from the application startup to sampling of the old generation (all GC) GC times FGCT from the application to sampling time (s) GCT from the application to sampling.

10、jstat -gcpermcapacity<pid>: permThe information of the object and its amount.

PGCMN permThe maximum capacity (bytes) of initialization (minimum) size (bytes) in PGCMX perm generation.PGC perm takes the capacity (bytes) of the newly generated capacity (bytes) PC Perm (persistent generation) from the application startup to the sampling time.The number of GC in light generation is FGC from application startup to sampling old generation (full GC) GC times FGCT from application process.
The total time (GC) of old generation (full GC) GC usage time (s) GCT from application startup to sampling time when sampling is started to sampling (s).

11、jstat -printcompilation <pid>:The information that the current VM executes.

Compiled The number of compiled tasks is generated by the Size method. The size of the bytecode is Type compiled type Method, the class name and the method name are used to identify the compilation method. The class name is used / done as a namespace separator. The method name is the method in the given class.
The above format is set by the -XX:+PrintComplation option.

 

Leave a Reply

Your email address will not be published. Required fields are marked *