4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Jboss GC状況確認 備忘

Posted at

GCログ関連のパラメータ

Jboss起動時にJavaVMに渡すパラメータ
standaloneモードの場合、standalone.confで設定
domainモードの場合、host.xmlに設定

| 項目 | 内容
--- | --- | ---
1 | -verbose:gc | GCログを出力する
2 | -Xloggc:”ログファイル名” | 指定したログファイル名へGCログを出力する
3 | -XX:+PrintGCDetails | GCの詳細情報を出力する
4 | -XX:+PrintGCDateStamps | GCログに日時を出力する
5 | -XX:+UseGCLogFileRotation | GCログをローテーションする
6 | -XX:NumberOfGCLogFiles=x | ローテーションをxファイル行う
7 | -XX:GCLogFileSize=xM | GCログサイズがxMBに達した場合、ローテーションを行う

システムのスローダウンや一定時間無応答になる場合GCログの解析が必要なことが多い
GCログはJbossを起動するたび再作成されるのでgc.logはバックアップしておくのが無難

GCログの可視化

↓ GCViewerを利用
https://github.com/chewiebug/GCViewer/wiki/Changelog

グラフ化しないと状況がわかりずらいためGCログと合わせて必須のツール
image.png

Jstat

JDK標準でバンドルされているコマンドjstatを利用する
JVMの統計情報をモニターする際に使用

-gcオプションでJavaヒープ領域の全容量を取得

| 項目 | 内容
--- | --- | ---
1 | S0C | Survivor 領域 0 の現在の容量 (KB)
2 | S1C | Survivor 領域 1 の現在の容量 (KB)
3 | S0U | Survivor 領域 0 の使用率 (KB)
4 | S1U | Survivor 領域 1 の使用率 (KB)
5 | EC | Eden 領域の現在の容量 (KB)
6 | EU | Eden 領域の使用率 (KB)
7 | OC | Old 領域の現在の容量 (KB)
8 | OU | Old 領域の使用率 (KB)
9 | PC | Permanent 領域の現在の容量 (KB)
10 | PU | Permanent 領域の使用率 (KB)
11 | YGC | 若い世代の GC イベント数
12 | YGCT | 若い世代のガベージコレクション時間
13 | FGC | フル GC イベント数
14 | FGCT | フルガベージコレクション時間
15 | GCT | ガベージコレクション総時間

-gcutilオプションで使用率を表示

[hoge@hostname ~]$jstat -gcutil 21567 1000 10
引数は"プロセスID" "取得間隔ミリ秒" "取得回数"

  S0     S1     E      O      P     YGC    YGCT    FGC    FGCT     GCT

 12.44   0.00  27.20   9.49  96.70    78    0.176     5    0.495    0.672

 12.44   0.00  62.16   9.49  96.70    78    0.176     5    0.495    0.672

 12.44   0.00  83.97   9.49  96.70    78    0.176     5    0.495    0.672

  0.00   7.74   0.00   9.51  96.70    79    0.177     5    0.495    0.673

  0.00   7.74  23.37   9.51  96.70    79    0.177     5    0.495    0.673

  0.00   7.74  43.82   9.51  96.70    79    0.177     5    0.495    0.673

  0.00   7.74  58.11   9.51  96.71    79    0.177     5    0.495    0.673

GCやヒープメモリの使用状況は可視化しないとよくわからないためjstatもExcelなどでグラフ化は必要

4
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?