解释jstat结果

我是jstat工具的新手。 因此我做了如下的样本。

./jstat -gcutil -t 4001 5000 Timestamp S0 S1 EOP YGC YGCT FGC FGCT GCT 565088.4 0.00 0.89 75.86 40.59 84.80 405 3.822 4 0.549 4.371 565093.4 0.00 0.89 77.81 40.59 84.80 405 3.822 4 0.549 4.371 565098.4 0.00 0.89 77.81 40.59 84.80 405 3.822 4 0.549 4.371 565103.5 0.00 0.89 77.85 40.59 84.80 405 3.822 4 0.549 4.371 565108.5 0.00 0.89 77.85 40.59 84.80 405 3.822 4 0.549 4.371 565113.4 0.00 0.89 77.85 40.59 84.80 405 3.822 4 0.549 4.371 jstat -gc output S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT 704.0 704.0 0.4 0.0 6080.0 4013.8 14928.0 6335.2 21248.0 18019.6 436 3.957 4 0.549 4.506 704.0 704.0 0.4 0.0 6080.0 4016.6 14928.0 6335.2 21248.0 18019.6 436 3.957 4 0.549 4.506 704.0 704.0 0.4 0.0 6080.0 4135.4 14928.0 6335.2 21248.0 18019.6 436 3.957 4 0.549 4.506 704.0 704.0 0.4 0.0 6080.0 4135.4 14928.0 6335.2 21248.0 18019.6 436 3.957 4 0.549 4.506 704.0 704.0 0.4 0.0 6080.0 4135.4 14928.0 6335.2 21248.0 18019.6 436 3.957 4 0.549 4.506 704.0 704.0 0.4 0.0 6080.0 4135.4 14928.0 6335.2 21248.0 18019.6 436 3.957 4 0.549 4.506 

这个结果表明了什么? 哪些是要注意可能的内存问题的列,例如内存泄漏等。

查看文档:

https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstat.html

基本上一行是一个时间点。 这些列显示的数据超出了JVM内存区域(Survivor,Eden,…),如果不了解JVM的工作原理,就无法理解它们。

例如, 在年轻一代的JVM垃圾收集文章中有一些解释。

以下是JVM对象生成的工作原理

Eden是一个创造新物体的地方。 当Eden已满时,运行一个small GC :如果一个对象没有引用它,它将被删除,否则它将存活,并移动到Survivor空间(一次只使用一个幸存空间,来自其他空间的所有对象都被复制到那里)。

如果一个对象经过一定数量的来回复制,它将被移动到Old空间。 如果旧空间已满,则运行Full GC ,这将影响JVM中的所有对象,因此操作更加繁重。

此外,还有Permanent空间,其中存储了“元数据”(类描述符,字段,方法,…描述符)。

gcutil根据百分比利用率给出统计数据

 -gcutil Option Summary of Garbage Collection Statistics Column Description S0 Survivor space 0 utilization as a percentage of the space's current capacity. S1 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. P Permanent space utilization as a percentage of the space's current capacity. 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. 

gc根据分配的空间和利用空间给出统计数据。

 -gc Option Garbage-collected heap statistics Column Description S0C Current survivor space 0 capacity (KB). S1C Current survivor space 1 capacity (KB). S0U Survivor space 0 utilization (KB). S1U Survivor space 1 utilization (KB). EC Current eden space capacity (KB). EU Eden space utilization (KB). OC Current old space capacity (KB). OU Old space utilization (KB). PC Current permanent space capacity (KB). PU Permanent space utilization (KB). 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. 

资料来源: 文件

使用这个简单的在线jstat可视化工具来绘制jstat GC统计数据。