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 options | effect |
---|
-gc | Monitor 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 |
-gccapacity | The 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 |
-gcutil | The monitoring content is basically the same as - gc, but the output mainly focuses on the percentage of used space in the total space |
-gccause | The function is the same as that of - gcutil, but it will output the cause of the last garbage collection |
-gcnew | Show Cenozoic statistics |
-gcnewcapacity | Statistics on the usage of the new generation and memory. The output mainly focuses on the maximum and minimum space used |
-gcold | Statistics of old age and meta space usage |
-gcoldcapacity | Statistics of memory usage in the old age. The output mainly focuses on the maximum and minimum space used |
-gcmetacapacity | Statistics on meta space usage |
-printcompilation | Output methods that have been compiled in time |
-compiler | Output the method and time-consuming information compiled by the compiler in time |
-class | Monitor the number of classes loaded and unloaded, the total space, and the time taken for class loading |
-gcpermcapacity | Maximum 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 item | describe |
---|
S0C | Total capacity of the first surviving area (KB) |
S1C | Total capacity of the second surviving area (KB) |
S0U | Used capacity of the first surviving area (KB) |
S1U | Used capacity of the second surviving area (KB) |
EC | Total capacity of Eden (KB) |
EU | Eden used capacity (KB) |
OC | Total capacity of elderly area (KB) |
OU | Age usage size (KB) |
MC | Total capacity of meta space (KB) |
MU | Used capacity of meta space (KB) |
CCSC | Total capacity of compressed class space (KB) |
CCSU | Total used capacity of compressed class space (KB) |
YGC | Cenozoic GC times |
YGCT | Total time consumption of Cenozoic GC |
FGC | FullGC times |
FGCT | FullGC total time spent |
GCT | Total 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 item | describe |
---|
NGCMN | Cenozoic minimum capacity (kB) |
NGCMX | Cenozoic maximum capacity (kB) |
NGC | Current Cenozoic capacity (kB) |
S0C | First surviving area size (kB) |
S1C | Size of the second surviving area (kB) |
EC | Size of Eden Park (kB) |
OGCMN | Minimum capacity in old age (kB) |
OGCMX | Maximum capacity in old age (kB) |
OGC | Current generation capacity (kB) |
OC | Current generation size (kB) |
MCMN | Minimum metadata capacity (kB) |
MCMX | Maximum metadata capacity (kB) |
MC | Current metadata space size (kB) |
CCSMN | Minimum compressed class space size (kB) |
CCSMX | Maximum compressed class space size (kB) |
CCSC | Current compressed class space size (kB) |
YGC | gc times of young generation |
FGC | Number 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 item | describe |
---|
S0 | Percentage of space used in the first surviving area |
S1 | Percentage of space used in the second surviving area |
E | Percentage of space used in Eden |
O | Percentage of used space in the elderly area |
M | Meta space usage percentage |
CCS | Compressed class space usage percentage |
YGC | Cenozoic GC times |
YGCT | Total time consumption of Cenozoic GC |
FGC | GC times of elderly generation |
FGCT | Older generation GC takes time |
GCT | Total 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 item | describe |
---|
S0 | Percentage of space used in the first surviving area |
S1 | Percentage of space used in the second surviving area |
E | Percentage of space used in Eden |
O | Percentage of used space in the elderly area |
M | Meta space usage percentage |
CCS | Compressed class space usage percentage |
YGC | Cenozoic GC times |
FGC | GC times of elderly generation |
LGCC | Last GC reason |
GCC | Current 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 item | describe |
---|
S0C | Total space size of the first surviving area (KB) |
S1C | Total space size of the second surviving area (KB) |
S0U | Used space size of the first surviving area (KB) |
S1U | Second surviving area used space size (KB) |
TT | Lifting threshold |
MTT | Maximum threshold |
DSS | Expected survivor area size (KB) |
EC | Total space size of Eden (KB) |
EU | Eden used space size (KB) |
YGC | gc times of young generation |
YGCT | Total 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 item | describe |
---|
NGCMN | Cenozoic minimum space size (KB) |
NGCMX | Cenozoic maximum space size (KB) |
NGC | Current Cenozoic space size (KB) |
S0CMX | Maximum space size of the first surviving area (KB) |
S0C | Current space size of the first surviving area (KB) |
S1CMX | Maximum space size of the second surviving area (KB) |
S1C | Current space size of the second surviving area (KB) |
ECMX | Maximum space size of Eden (KB) |
EC | Current space size of Eden (KB) |
YGC | Cenozoic GC times |
FGC | GC 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 item | describe |
---|
MC | Total size of meta space (KB) |
MU | Used size of meta space (KB) |
CCSC | Total size of compressed class space (KB) |
CCSU | Compressed class space used size (KB) |
OC | Total space size of senior area (KB) |
OU | Age zone used size (KB) |
YGC | Cenozoic GC times |
FGC | GC times of elderly generation |
FGCT | Total GC time for older generation |
GCT | Total 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 item | describe |
---|
OGCMN | Minimum space occupied by the elderly area (KB) |
OGCMX | Maximum space occupied by the elderly area (KB) |
OGC | Current geriatric space (KB) |
OC | Current geriatric space (KB) |
YGC | Cenozoic GC times |
FGC | GC times of elderly generation |
FGCT | Total GC time for older generation |
GCT | Total 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 item | describe |
---|
MCMN | Minimum space size of meta space (KB) |
MCMX | Maximum size of meta space (KB) |
MC | Current size of meta space (KB) |
CCSMN | Minimum space size of compressed class space (KB) |
CCSMX | Maximum size of compressed class space (KB) |
CCSC | Current size of compressed class space (KB) |
YGC | Cenozoic GC times |
FGC | GC times of elderly generation |
FGCT | Older generation GC takes time |
GCT | Total 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 item | describe |
---|
Compiled | Number of compiled methods |
Size | Last method compilation size |
Type | Last compiled method type |
Method | Last 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 item | describe |
---|
Compiled | Number of successful compilation |
Failed | Number of compilation failures |
Invalid | Invalid quantity |
Time | Compile time |
FailedType | Last compilation failure type |
FailedMethod | Method 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 item | describe |
---|
Loaded | Number of class es loaded |
Bytes | Size of loaded class in KB |
Unloaded | Number of unloaded class es |
Bytes | Size of unloaded class in KB |
Time | Time spent loading and unloading class es |