34

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

この結果は何を示していますか? メモリリークなどの可能性のあるメモリの問題を探す列はどれですか。

4

3 に答える 3

31

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.

出典:ドキュメント

于 2014-01-16T05:52:03.983 に答える
30

See the documentation:

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

Basically one row is one point in time. The columns show data about the JVM memory areas (Survivor, Eden, ...), understanding them is impossible without knowing how the JVM works.

For example in the article JVM garbage collection in young generation there is some explanation.

Here is the excerpt how JVM object generation works:

Eden新しいオブジェクトが作成された場所です。Eden がいっぱいになると、asmall GCが実行されます。オブジェクトへの参照がない場合、オブジェクトは削除されます。それ以外の場合は存続し、Survivorスペースに移動します (一度に使用されている生存スペースの 1 つだけ、そこからのすべてのオブジェクト)。他のスペースはそこにコピーされます)。

オブジェクトが一定回数の往復コピーに耐えた場合、そのオブジェクトはOldスペースに移動されます。Old スペースがいっぱいになると、aFull GCが実行され、JVM 内のすべてのオブジェクトに影響するため、操作が非常に重くなります。

また、Permanent「メタデータ」(クラス記述子、フィールド、メソッド、...記述子)が格納されるスペースもあります。

于 2013-01-22T18:00:36.560 に答える
20

この単純なオンライン jstat ビジュアライザー ツールを使用して、jstat GC 統計をプロットします。

于 2015-01-02T22:16:26.483 に答える