解释jstat结果

时间:2013-01-22 17:55:50

标签: java memory-management

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

./jstat -gcutil -t 4001 5000
Timestamp         S0     S1     E      O      P     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

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

3 个答案:

答案 0 :(得分:27)

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.

来源:Docs

答案 1 :(得分:23)

参见文档:

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

基本上一行是一个时间点。这些列显示了JVM内存区域(Survivor,Eden,...)的数据,在不知道JVM如何工作的情况下理解它们是不可能的。

例如,文章JVM garbage collection in young generation中有一些解释。

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

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

如果某个对象在一定数量的来回复制中存活,则会将其移至Old空间。如果旧空间已满,则运行Full GC,这将影响JVM中的所有对象,因此操作更加繁重。

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

答案 2 :(得分:17)

使用这个简单的online jstat visualizer tool来绘制jstat GC统计数据。

相关问题