JVM: jstat virtual machine statistics monitoring tool (JDK1.8)

1, Overview

The jstat command can view the usage of various parts of heap memory and the number of loaded classes. The format of the command is as follows:

jstat [-Command options] [-t] [-h<lines>] [vmid] [Interval time/The default unit is ms millisecond] [Query times]
# Example: print once every 500 milliseconds for a total of 10 times, and output the title every three lines of data
jstat -gc -t -h3 1 500 10
Command optionseffect
-gcMonitor the status of Java heap, including Eden area, 2 Survivor areas, old age, permanent generation and other capacities. Used space, garbage collection time, total and other information
-gccapacityThe monitoring content is basically the same as - gc, but the output mainly focuses on the maximum and minimum space used by each area of the Java heap
-gcutilThe monitoring content is basically the same as - gc, but the output mainly focuses on the percentage of used space in the total space
-gccauseThe function is the same as that of - gcutil, but it will output the cause of the last garbage collection
-gcnewShow Cenozoic statistics
-gcnewcapacityStatistics on the usage of the new generation and memory. The output mainly focuses on the maximum and minimum space used
-gcoldStatistics of old age and meta space usage
-gcoldcapacityStatistics of memory usage in the old age. The output mainly focuses on the maximum and minimum space used
-gcmetacapacityStatistics on meta space usage
-printcompilationOutput methods that have been compiled in time
-compilerOutput the method and time-consuming information compiled by the compiler in time
-classMonitor the number of classes loaded and unloaded, the total space, and the time taken for class loading
-gcpermcapacityMaximum and minimum space of output permanent generation (permanent generation has been completely removed in JDK1.8)

2, Enter item number Description

jstat -gc input item number Description

[root@root ~]# jstat -gc 1
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT   
17472.0 17472.0  0.0   1248.6 139776.0  7359.2   349568.0   233485.7  149632.0 144590.5 16768.0 15863.7   1119   11.856  11      2.871   14.727
Input itemdescribe
S0CTotal capacity of the first surviving area (KB)
S1CTotal capacity of the second surviving area (KB)
S0UUsed capacity of the first surviving area (KB)
S1UUsed capacity of the second surviving area (KB)
ECTotal capacity of Eden (KB)
EUEden used capacity (KB)
OCTotal capacity of elderly area (KB)
OUAge usage size (KB)
MCTotal capacity of meta space (KB)
MUUsed capacity of meta space (KB)
CCSCTotal capacity of compressed class space (KB)
CCSUTotal used capacity of compressed class space (KB)
YGCCenozoic GC times
YGCTTotal time consumption of Cenozoic GC
FGCFullGC times
FGCTFullGC total time spent
GCTTotal GC time

jstat -gccapacity input item number Description

[root@root ~]# jstat -gccapacity 1
 NGCMN    NGCMX     NGC     S0C   S1C       EC      OGCMN      OGCMX       OGC         OC       MCMN     MCMX      MC     CCSMN    CCSMX     CCSC    YGC    FGC 
 10880.0 174720.0 174720.0 17472.0 17472.0 139776.0    21888.0   349568.0   349568.0   349568.0      0.0 1181696.0 149632.0      0.0 1048576.0  16768.0   1119    11
Input itemdescribe
NGCMNCenozoic minimum capacity (kB)
NGCMXCenozoic maximum capacity (kB)
NGCCurrent Cenozoic capacity (kB)
S0CFirst surviving area size (kB)
S1CSize of the second surviving area (kB)
ECSize of Eden Park (kB)
OGCMNMinimum capacity in old age (kB)
OGCMXMaximum capacity in old age (kB)
OGCCurrent generation capacity (kB)
OCCurrent generation size (kB)
MCMNMinimum metadata capacity (kB)
MCMXMaximum metadata capacity (kB)
MCCurrent metadata space size (kB)
CCSMNMinimum compressed class space size (kB)
CCSMXMaximum compressed class space size (kB)
CCSCCurrent compressed class space size (kB)
YGCgc times of young generation
FGCNumber of GC in the elderly generation (fullgc)

jstat -gcutil input item number Description

[root@root ~]# jstat -gcutil 1
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT   
  6.68   0.00  39.54  66.79  96.66  94.62   1132   11.970    11    2.871   14.841
Input itemdescribe
S0Percentage of space used in the first surviving area
S1Percentage of space used in the second surviving area
EPercentage of space used in Eden
OPercentage of used space in the elderly area
MMeta space usage percentage
CCSCompressed class space usage percentage
YGCCenozoic GC times
YGCTTotal time consumption of Cenozoic GC
FGCGC times of elderly generation
FGCTOlder generation GC takes time
GCTTotal GC time

jstat -gccause input item number Description

[root@root ~]# jstat -gccause 1
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC                 
  6.67   0.00  90.76  66.79  96.66  94.62   1130   11.949    11    2.871   14.820 Allocation Failure   No GC 
Input itemdescribe
S0Percentage of space used in the first surviving area
S1Percentage of space used in the second surviving area
EPercentage of space used in Eden
OPercentage of used space in the elderly area
MMeta space usage percentage
CCSCompressed class space usage percentage
YGCCenozoic GC times
FGCGC times of elderly generation
LGCCLast GC reason
GCCCurrent GC reason

jstat -gcnew input item number Description

[root@root ~]# jstat -gcnew 1
 S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT  
17472.0 17472.0    0.0 1350.4 15  15 8736.0 139776.0  73826.1   1131   11.957
Input itemdescribe
S0CTotal space size of the first surviving area (KB)
S1CTotal space size of the second surviving area (KB)
S0UUsed space size of the first surviving area (KB)
S1USecond surviving area used space size (KB)
TTLifting threshold
MTTMaximum threshold
DSSExpected survivor area size (KB)
ECTotal space size of Eden (KB)
EUEden used space size (KB)
YGCgc times of young generation
YGCTTotal time consumption of Cenozoic GC

jstat -gcnewcapacity input item number Description

[root@root ~]# jstat -gcnewcapacity 1
  NGCMN      NGCMX       NGC      S0CMX     S0C     S1CMX     S1C       ECMX        EC      YGC   FGC 
   10880.0   174720.0   174720.0  17472.0  17472.0  17472.0  17472.0   139776.0   139776.0  1131    11
Input itemdescribe
NGCMNCenozoic minimum space size (KB)
NGCMXCenozoic maximum space size (KB)
NGCCurrent Cenozoic space size (KB)
S0CMXMaximum space size of the first surviving area (KB)
S0CCurrent space size of the first surviving area (KB)
S1CMXMaximum space size of the second surviving area (KB)
S1CCurrent space size of the second surviving area (KB)
ECMXMaximum space size of Eden (KB)
ECCurrent space size of Eden (KB)
YGCCenozoic GC times
FGCGC times of elderly generation

jstat -gcold input item number Description

[root@root ~]# jstat -gcold 1
   MC       MU      CCSC     CCSU       OC          OU       YGC    FGC    FGCT     GCT   
149632.0 144638.0  16768.0  15866.4    349568.0    233488.9   1132    11    2.871   14.841
Input itemdescribe
MCTotal size of meta space (KB)
MUUsed size of meta space (KB)
CCSCTotal size of compressed class space (KB)
CCSUCompressed class space used size (KB)
OCTotal space size of senior area (KB)
OUAge zone used size (KB)
YGCCenozoic GC times
FGCGC times of elderly generation
FGCTTotal GC time for older generation
GCTTotal GC time

jstat -gcoldcapacity input item number Description

[root@root ~]# jstat -gcoldcapacity 1
   OGCMN       OGCMX        OGC         OC       YGC   FGC    FGCT     GCT   
    21888.0    349568.0    349568.0    349568.0  1132    11    2.871   14.841
Input itemdescribe
OGCMNMinimum space occupied by the elderly area (KB)
OGCMXMaximum space occupied by the elderly area (KB)
OGCCurrent geriatric space (KB)
OCCurrent geriatric space (KB)
YGCCenozoic GC times
FGCGC times of elderly generation
FGCTTotal GC time for older generation
GCTTotal GC time

Jstat - gcmetetapacity description of the number of input items

[root@root ~]# jstat -gcmetacapacity 1
   MCMN       MCMX        MC       CCSMN      CCSMX       CCSC     YGC   FGC    FGCT     GCT   
       0.0  1181696.0   149632.0        0.0  1048576.0    16768.0  1131    11    2.871   14.828
Input itemdescribe
MCMNMinimum space size of meta space (KB)
MCMXMaximum size of meta space (KB)
MCCurrent size of meta space (KB)
CCSMNMinimum space size of compressed class space (KB)
CCSMXMaximum size of compressed class space (KB)
CCSCCurrent size of compressed class space (KB)
YGCCenozoic GC times
FGCGC times of elderly generation
FGCTOlder generation GC takes time
GCTTotal GC time

jstat -printcompilation description of the number of input items

[root@root ~]# jstat -printcompilation 1
Compiled  Size  Type Method
   31174   1055    1 sun/reflect/GeneratedMethodAccessor214 invoke
Input itemdescribe
CompiledNumber of compiled methods
SizeLast method compilation size
TypeLast compiled method type
MethodLast compiled method

jstat -compiler input item number Description

[root@root ~]# jstat -compiler 1
Compiled Failed Invalid   Time   FailedType FailedMethod
   31073      3       0   182.63          1 com/mysql/jdbc/AbandonedConnectionCleanupThread run
Input itemdescribe
CompiledNumber of successful compilation
FailedNumber of compilation failures
InvalidInvalid quantity
TimeCompile time
FailedTypeLast compilation failure type
FailedMethodMethod of invalidation of the last compilation

jstat -class input item number Description

[root@root ~]# jstat -class 1
Loaded  Bytes  Unloaded  Bytes     Time   
 24301 45978.0      277   411.9      44.91
Input itemdescribe
LoadedNumber of class es loaded
BytesSize of loaded class in KB
UnloadedNumber of unloaded class es
BytesSize of unloaded class in KB
TimeTime spent loading and unloading class es

Tags: Java JavaEE

Posted on Wed, 24 Nov 2021 09:35:21 -0500 by eddy666