Java jstat 命令查看 JVM 垃圾回收情况

JVM jstat 诊断工具 About 3,180 words

jstat 选项

使用jstat -options查看支持的选项

  • class:类加载统计(Displays statistics about the behavior of the class loader.)
  • compiler:编译统计(Displays statistics about the behavior of the Java HotSpot VM Just-in-Time compiler.)
  • gc:垃圾回收统计(Displays statistics about the behavior of the garbage collected heap.)
  • gccapacity:堆内存统计(Displays statistics about the capacities of the generations and their corresponding spaces.
  • gccause:垃圾回收原因(Displays a summary about garbage collection statistics (same as -gcutil), with the cause of the last and current (when applicable) garbage collection events.)
  • gcnew:新生代垃圾回收统计(Displays statistics of the behavior of the new generation.)
  • gcnewcapacity:新生代内存统计(Displays statistics about the sizes of the new generations and its corresponding spaces.)
  • gcold:老年代垃圾回收统计(Displays statistics about the behavior of the old generation and metaspace statistics.)
  • gcoldcapacity:老年代内存统计(Displays statistics about the sizes of the old generation.)
  • gcmetacapacity:元数据空间统计(Displays statistics about the sizes of the metaspace.)
  • gcutil:总结垃圾回收统计(Displays a summary about garbage collection statistics.)
  • printcompilation:JVM编译方法统计(Displays Java HotSpot VM compilation method statistics.)

最常用选项

gcutil

jstat -gcutil <pid> 2000
  • S0:幸存区1当前使用比例(Survivor space 0 utilization as a percentage of the space's current capacity.)
  • S1:幸存区2当前使用比例(Survivor space 1 utilization as a percentage of the space's current capacity.)
  • E:伊甸园区使用比例(Eden space utilization as a percentage of the space's current capacity.)
  • O:老年代使用比例(Old space utilization as a percentage of the space's current capacity.)
  • M:元数据区使用比例(Metaspace utilization as a percentage of the space's current capacity.)
  • CCS:压缩使用比例(Compressed class space utilization as a percentage.)
  • YGC:年轻代垃圾回收次数(Number of young generation GC events.)
  • YGCT:年轻代垃圾回收消耗时间Young generation garbage collection time.
  • FGC:老年代垃圾回收次数(Number of full GC events.)
  • FGCT:老年代垃圾回收消耗时间(Full garbage collection time.)
  • GCT:垃圾回收消耗总时间(Total garbage collection time.)

gccause (推荐使用)

gcutil拥有的输出列gccause也都拥有,还额外多了最后一次GC原因和当前GC原因。

jstat -gccause <pid> 2000
  • LGCC:最后一次GC原因(Cause of last garbage collection)
  • GCC:当前GC原因(Cause of current garbage collection)
[root@root ~]jstat -gccause 14292 2000
  S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC                 
  0.00 100.00  47.64  19.39  96.63  92.26   3211  100.224     0    0.000  100.224 G1 Evacuation Pause  No GC               
  0.00 100.00  47.81  19.39  96.63  92.26   3211  100.224     0    0.000  100.224 G1 Evacuation Pause  No GC               
  0.00 100.00  48.15  19.39  96.63  92.26   3211  100.224     0    0.000  100.224 G1 Evacuation Pause  No GC               
  0.00 100.00  48.31  19.39  96.63  92.26   3211  100.224     0    0.000  100.224 G1 Evacuation Pause  No GC               
  0.00 100.00  48.48  19.39  96.63  92.26   3211  100.224     0    0.000  100.224 G1 Evacuation Pause  No GC               
  0.00 100.00  48.65  19.39  96.63  92.26   3211  100.224     0    0.000  100.224 G1 Evacuation Pause  No GC               
  0.00 100.00  48.90  19.39  96.63  92.26   3211  100.224     0    0.000  100.224 G1 Evacuation Pause  No GC 
Views: 5,851 · Posted: 2019-09-06

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh