天天看点

Java性能监控与调优-jstat查看JVM统计信息

更多内容:

Java性能监控与调优目录导航

查看哪些方面的信息?

1,类编译信息统计

-class option

输出参数

Class loader statistics.

Loaded: Number of classes loaded.(加载的类数。)

Bytes: Number of kBs loaded.(装载的字节数。)

Unloaded: Number of classes unloaded.

Bytes: Number of Kbytes unloaded.

Time: Time spent performing class loading and unloading operations.(用于执行类加载和卸载操作的时间。)

[[email protected] ~]# jps
11184 Jps
7844 Bootstrap
[[email protected] ~]# jstat -class 7844
Loaded  Bytes  Unloaded  Bytes     Time   
  8958 17080.3        1     1.0       9.50
           

2,垃圾回收统计

-gc

输出参数(太多没搞太明白,过)

Java性能监控与调优-jstat查看JVM统计信息
[[email protected] ~]# jstat -gc 7844
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT   
11264.0 21504.0 8952.1  0.0   205824.0 205824.0  89600.0    47603.9   51840.0 50721.2 6272.0 6032.1     36    0.597   3      0.333    0.930
           

如果需要每1秒输出一次,输出10次,则可以这么写

jstat -gc 7844 1000 10
           
Java性能监控与调优-jstat查看JVM统计信息

堆区的S0和S1的大小是一样的,同时只能用其中一个.

非堆区是我们操作系统的本命内存,是区别于JVM的内存之外的,其中Metaspace是jdk1.8后才出现的,之前没有。

Java性能监控与调优-jstat查看JVM统计信息

3,其他垃圾回收统计信息

gccapacity gccause gcnew ...等等

4,JIT编译统计

-compiler,

参数

option

Java HotSpot VM Just-in-Time compiler statistics.

Compiled: Number of compilation tasks performed.(编译任务执行的数目)

Failed: Number of compilations tasks failed.

Invalid: Number of compilation tasks that were invalidated.

Time: Time spent performing compilation tasks.(毫秒)

FailedType: Compile type of the last failed compilation.

FailedMethod: Class name and method of the last failed compilation.

格式:

[[email protected] ~]# jstat -compiler 7844
Compiled Failed Invalid   Time   FailedType FailedMethod
    6678      1       0    21.75          1 com/mysql/jdbc/AbandonedConnectionCleanupThread run
           

继续阅读