虚拟机统计监控工具-jstat


介绍jstat工具的使用。

jstat帮助

C:\Users\admin>jstat -help
Usage: jstat -help|-options
       jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]

Definitions:
  <option>      An option reported by the -options option
  <vmid>        Virtual Machine Identifier. A vmid takes the following form:
                     <lvmid>[@<hostname>[:<port>]]
                Where <lvmid> is the local vm identifier for the target
                Java virtual machine, typically a process id; <hostname> is
                the name of the host running the target Java virtual machine;
                and <port> is the port number for the rmiregistry on the
                target host. See the jvmstat documentation for a more complete
                description of the Virtual Machine Identifier.
  <lines>       Number of samples between header lines.
  <interval>    Sampling interval. The following forms are allowed:
                    <n>["ms"|"s"]
                Where <n> is an integer and the suffix specifies the units as
                milliseconds("ms") or seconds("s"). The default units are "ms".
  <count>       Number of samples to take before terminating.
  -J<flag>      Pass <flag> directly to the runtime system.

jstat参数

C:\Users\admin>jstat -options
-class
-compiler
-gc
-gccapacity
-gccause
-gcmetacapacity
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcutil
-printcompilation

用法解释

jstat命令可以查看堆内存各部分的使用量,以及加载类的数量。命令的格式如下:
jstat [-命令选项] [vmid] [间隔时间/毫秒] [查询次数]

注意!!!:使用的jdk版本是jdk8.

类加载统计:

C:\Users\admin>jstat -class 20168 250 20
Loaded  Bytes  Unloaded  Bytes     Time
  6324 11416.6       45    64.5       3.25
  6324 11416.6       45    64.5       3.25
  6324 11416.6       45    64.5       3.25
  6324 11416.6       45    64.5       3.25
  6324 11416.6       45    64.5       3.25

Loaded:加载class的数量
Bytes:所占用空间大小
Unloaded:未加载数量
Bytes:未加载占用空间
Time:时间

编译统计

C:\Users\admin>jstat -compiler 20168 250 20
Compiled Failed Invalid   Time   FailedType FailedMethod
    3039      0       0     0.58          0
    3039      0       0     0.58          0
    3039      0       0     0.58          0
    3039      0       0     0.58          0
    3039      0       0     0.58          0
    3039      0       0     0.58          0
    3039      0       0     0.58          0
    3039      0       0     0.58          0

Compiled:编译数量。
Failed:失败数量
Invalid:不可用数量
Time:时间
FailedType:失败类型
FailedMethod:失败的方法

垃圾回收统计

C:\Users\admin>jstat -gc 20168 250 20
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817

S0C:第一个幸存区的大小
S1C:第二个幸存区的大小
S0U:第一个幸存区的使用大小
S1U:第二个幸存区的使用大小
EC:伊甸园区的大小
EU:伊甸园区的使用大小
OC:老年代大小
OU:老年代使用大小
MC:方法区大小
MU:方法区使用大小
CCSC:压缩类空间大小
CCSU:压缩类空间使用大小
YGC:年轻代垃圾回收次数
YGCT:年轻代垃圾回收消耗时间
FGC:老年代垃圾回收次数
FGCT:老年代垃圾回收消耗时间
GCT:垃圾回收消耗总时间

堆内存统计

C:\Users\admin>jstat -gc 20168 250 20
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817
2048.0 2048.0 836.2   0.0    6144.0   974.5    20480.0    15328.3   32768.0 30743.5 4608.0 4166.8     53    0.082   7      0.735    0.817

NGCMN:新生代最小容量
NGCMX:新生代最大容量
NGC:当前新生代容量
S0C:第一个幸存区大小
S1C:第二个幸存区的大小
EC:伊甸园区的大小
OGCMN:老年代最小容量
OGCMX:老年代最大容量
OGC:当前老年代大小
OC:当前老年代大小
MCMN:最小元数据容量
MCMX:最大元数据容量
MC:当前元数据空间大小
CCSMN:最小压缩类空间大小
CCSMX:最大压缩类空间大小
CCSC:当前压缩类空间大小
YGC:年轻代gc次数
FGC:老年代GC次数

新生代垃圾回收统计

 S0C    S1C    S0U    S1U   TT MTT  DSS      EC       EU     YGC     YGCT
2048.0 2048.0  836.2    0.0  7  15 2048.0   6144.0   1018.0     53    0.082
2048.0 2048.0  836.2    0.0  7  15 2048.0   6144.0   1018.0     53    0.082
2048.0 2048.0  836.2    0.0  7  15 2048.0   6144.0   1018.0     53    0.082

S0C:第一个幸存区大小
S1C:第二个幸存区的大小
S0U:第一个幸存区的使用大小
S1U:第二个幸存区的使用大小
TT:对象在新生代存活的次数
MTT:对象在新生代存活的最大次数
DSS:期望的幸存区大小
EC:伊甸园区的大小
EU:伊甸园区的使用大小
YGC:年轻代垃圾回收次数
YGCT:年轻代垃圾回收消耗时间

新生代内存统计

C:\Users\admin>jstat -gcnewcapacity 20168 250 20
  NGCMN      NGCMX       NGC      S0CMX     S0C     S1CMX     S1C       ECMX        EC      YGC   FGC
   10240.0    10240.0    10240.0   3072.0   2048.0   3072.0   2048.0     9216.0     6144.0    53     7
   10240.0    10240.0    10240.0   3072.0   2048.0   3072.0   2048.0     9216.0     6144.0    53     7
   10240.0    10240.0    10240.0   3072.0   2048.0   3072.0   2048.0     9216.0     6144.0    53     7
   10240.0    10240.0    10240.0   3072.0   2048.0   3072.0   2048.0     9216.0     6144.0    53     7

NGCMN:新生代最小容量
NGCMX:新生代最大容量
NGC:当前新生代容量
S0CMX:最大幸存1区大小
S0C:当前幸存1区大小
S1CMX:最大幸存2区大小
S1C:当前幸存2区大小
ECMX:最大伊甸园区大小
EC:当前伊甸园区大小
YGC:年轻代垃圾回收次数
FGC:老年代回收次数

老年代垃圾回收统计

C:\Users\admin>jstat -gcold 20168 250 20
   MC       MU      CCSC     CCSU       OC          OU       YGC    FGC    FGCT     GCT
 32768.0  30743.5   4608.0   4166.8     20480.0     15328.3     53     7    0.735    0.817
 32768.0  30743.5   4608.0   4166.8     20480.0     15328.3     53     7    0.735    0.817
 32768.0  30743.5   4608.0   4166.8     20480.0     15328.3     53     7    0.735    0.817
 32768.0  30743.5   4608.0   4166.8     20480.0     15328.3     53     7    0.735    0.817
 32768.0  30743.5   4608.0   4166.8     20480.0     15328.3     53     7    0.735    0.817

MC:方法区大小
MU:方法区使用大小
CCSC:压缩类空间大小
CCSU:压缩类空间使用大小
OC:老年代大小
OU:老年代使用大小
YGC:年轻代垃圾回收次数
FGC:老年代垃圾回收次数
FGCT:老年代垃圾回收消耗时间
GCT:垃圾回收消耗总时间

老年代内存统计

C:\Users\admin>jstat -gcoldcapacity 20168 250 20
   OGCMN       OGCMX        OGC         OC       YGC   FGC    FGCT     GCT
    20480.0     20480.0     20480.0     20480.0    53     7    0.735    0.817
    20480.0     20480.0     20480.0     20480.0    53     7    0.735    0.817
    20480.0     20480.0     20480.0     20480.0    53     7    0.735    0.817
    20480.0     20480.0     20480.0     20480.0    53     7    0.735    0.817

OGCMN:老年代最小容量
OGCMX:老年代最大容量
OGC:当前老年代大小
OC:老年代大小
YGC:年轻代垃圾回收次数
FGC:老年代垃圾回收次数
FGCT:老年代垃圾回收消耗时间
GCT:垃圾回收消耗总时间

元数据空间统计

C:\Users\admin>jstat -gcmetacapacity 20168 250 20
   MCMN       MCMX        MC       CCSMN      CCSMX       CCSC     YGC   FGC    FGCT     GCT
       0.0  1077248.0    32768.0        0.0  1048576.0     4608.0    53     7    0.735    0.817
       0.0  1077248.0    32768.0        0.0  1048576.0     4608.0    53     7    0.735    0.817
       0.0  1077248.0    32768.0        0.0  1048576.0     4608.0    53     7    0.735    0.817
       0.0  1077248.0    32768.0        0.0  1048576.0     4608.0    53     7    0.735    0.817

MCMN: 最小元数据容量
MCMX:最大元数据容量
MC:当前元数据空间大小
CCSMN:最小压缩类空间大小
CCSMX:最大压缩类空间大小
CCSC:当前压缩类空间大小
YGC:年轻代垃圾回收次数
FGC:老年代垃圾回收次数
FGCT:老年代垃圾回收消耗时间
GCT:垃圾回收消耗总时间

总结垃圾回收统计

C:\Users\admin>jstat -gcutil 20168 250 20
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT
 40.83   0.00  18.06  74.85  93.82  90.42     53    0.082     7    0.735    0.817
 40.83   0.00  18.06  74.85  93.82  90.42     53    0.082     7    0.735    0.817

S0:幸存1区当前使用比例
S1:幸存2区当前使用比例
E:伊甸园区使用比例
O:老年代使用比例
M:元数据区使用比例
CCS:压缩使用比例
YGC:年轻代垃圾回收次数
FGC:老年代垃圾回收次数
FGCT:老年代垃圾回收消耗时间
GCT:垃圾回收消耗总时间

JVM编译方法统计

C:\Users\admin>jstat -printcompilation 20168 250 20
Compiled  Size  Type Method
    3039      5    1 org/springframework/web/servlet/handler/AbstractHandlerMethodMapping$Match access$200
    3039      5    1 org/springframework/web/servlet/handler/AbstractHandlerMethodMapping$Match access$200
    3039      5    1 org/springframework/web/servlet/handler/AbstractHandlerMethodMapping$Match access$200
    3039      5    1 org/springframework/web/servlet/handler/AbstractHandlerMethodMapping$Match access$200

Compiled:最近编译方法的数量
Size:最近编译方法的字节码数量
Type:最近编译方法的编译类型。
Method:方法名标识。


发布了25 篇原创文章 · 获赞 7 · 访问量 910

猜你喜欢

转载自blog.csdn.net/m0_46485771/article/details/105731126