更多内容:
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
輸出參數(太多沒搞太明白,過)

[[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
附
堆區的S0和S1的大小是一樣的,同時隻能用其中一個.
非堆區是我們作業系統的本命記憶體,是差別于JVM的記憶體之外的,其中Metaspace是jdk1.8後才出現的,之前沒有。
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