tWASで、スレッドプールの状態をSystemOut.logまたはtrace.logに出力する方法です。デフォルト3分おきに出力されます。
以下のトレース仕様を設定するとログに出力されます。
「Runtime.ThreadMonitorHeartbeat=detail」を指定するとSystemOut.logに出力されます。
「Runtime.ThreadMonitorHeartbeat=finest」を指定するとtrace.logに出力されます。
参考: トレースを設定する手順
アプリケーションサーバーの管理対象スレッドに対して問い合わせが行われる間隔は、「com.ibm.websphere.threadmonitor.interval」が使用されます。デフォルト 180秒(3分)です。
ハング検出ポリシーの構成 - IBM Documentation
- 管理コンソールから、 サーバー > アプリケーション・サーバー > サーバー名 をクリックします。
- 「サーバー・インフラストラクチャー」の下で、 「管理」 > 「カスタム・プロパティー」をクリックします。
- 「新規」をクリックします。
- 以下のプロパティーを追加します。
名前 com.ibm.websphere.threadmonitor.interval
値 選択されているアプリケーション・サーバーの管理対象スレッドに対して、問い合わせが行われる頻度 (秒数)。
デフォルト 180 秒 (3 分)
出力フォーマット ThreadPool:hung/active/size/max
ThreadPool名:hungスレッド数、activeスレッド数、current size、max の順で出力されます
出力例
SystemOut.logの出力例
$ tail -f /logs/server1/SystemOut.log
[4/6/26 1:14:53:527 UTC] 000000aa ManagerAdmin I TRAS0018I: The trace state has changed. The new trace state is *=info:Runtime.ThreadMonitorHeartbeat=detail.
...
[4/6/26 1:17:31:376 UTC] 000000b3 ThreadMonitor A UsageInfo[ThreadPool:hung/active/size/max]={WebContainer:0/1/22/50,SoapConnectorThreadPool:0/0/2/50,HAManager.thread.pool:0/0/2/2,server.startup:0/0/1/3}
[4/6/26 1:20:31:385 UTC] 00000071 ThreadMonitor A UsageInfo[ThreadPool:hung/active/size/max]={WebContainer:0/1/22/50,SoapConnectorThreadPool:0/0/2/50,HAManager.thread.pool:0/0/2/2,server.startup:0/0/1/3}
[4/6/26 1:23:31:396 UTC] 00000038 ThreadMonitor A UsageInfo[ThreadPool:hung/active/size/max]={WebContainer:0/1/22/50,SoapConnectorThreadPool:0/0/2/50,HAManager.thread.pool:0/0/2/2,server.startup:0/0/1/3}
[4/6/26 1:26:31:406 UTC] 00000074 ThreadMonitor A UsageInfo[ThreadPool:hung/active/size/max]={WebContainer:0/1/22/50,SoapConnectorThreadPool:0/0/2/50,HAManager.thread.pool:0/0/2/2,server.startup:0/0/1/3}
[4/6/26 1:29:31:421 UTC] 000000b3 ThreadMonitor A UsageInfo[ThreadPool:hung/active/size/max]={WebContainer:0/1/22/50,SoapConnectorThreadPool:0/0/2/50,HAManager.thread.pool:0/0/2/2,server.startup:0/0/1/3}
trace.logの出力例
出力例
$ tail -f /logs/server1/trace.log
[4/6/26 1:11:31:374 UTC] 000000b3 ThreadMonitor > checkAllThreads Entry
[4/6/26 1:11:31:374 UTC] 000000b3 ThreadMonitor < checkAllThreads Exit
[4/6/26 1:11:31:375 UTC] 000000b3 ThreadMonitor 3 UsageInfo[ThreadPool:hung/active/size/max]={WebContainer:0/1/22/50,SoapConnectorThreadPool:0/0/2/50,HAManager.thread.pool:0/0/2/2,server.startup:0/0/1/3}
[4/6/26 1:14:31:374 UTC] 00000074 ThreadMonitor > checkAllThreads Entry
[4/6/26 1:14:31:375 UTC] 00000074 ThreadMonitor < checkAllThreads Exit
[4/6/26 1:14:31:376 UTC] 00000074 ThreadMonitor 3 UsageInfo[ThreadPool:hung/active/size/max]={WebContainer:0/1/22/50,SoapConnectorThreadPool:0/0/2/50,HAManager.thread.pool:0/0/2/2,server.startup:0/0/1/3}
WebContainerスレッドのみ抽出する例
SystemOut.logとヒストリカルファイルから抽出
$ grep 'WebContainer:' /logs/server1/SystemOut*.log | sed -n 's/^[^:]*:\(\[[^]]*\]\).*\(WebContainer:[0-9/]*\).*/\1 \2/p' | sort
[4/6/26 1:17:31:376 UTC] WebContainer:0/1/22/50
[4/6/26 1:20:31:385 UTC] WebContainer:0/1/22/50
[4/6/26 1:23:31:396 UTC] WebContainer:0/1/22/50
[4/6/26 1:26:31:406 UTC] WebContainer:0/1/22/50
[4/6/26 1:29:31:421 UTC] WebContainer:0/1/22/50
[4/6/26 1:32:31:431 UTC] WebContainer:0/1/22/50
[4/6/26 1:35:31:447 UTC] WebContainer:0/1/22/50
[4/6/26 1:38:31:456 UTC] WebContainer:0/1/22/50
[4/6/26 1:41:31:467 UTC] WebContainer:0/1/22/50
[4/6/26 1:44:31:479 UTC] WebContainer:0/1/22/50
[4/6/26 1:47:31:495 UTC] WebContainer:0/1/22/50
[4/6/26 1:50:31:506 UTC] WebContainer:0/1/22/50
[4/6/26 1:53:31:515 UTC] WebContainer:0/1/22/50
tailコマンドで抽出
$ tail -f /logs/server1/SystemOut.log | sed -un '/WebContainer:/s/^\(\[[^]]*\]\).*\(WebContainer:[0-9/]*\).*/\1 \2/p'
[4/6/26 4:26:32:051 UTC] WebContainer:0/1/22/50
[4/6/26 4:29:32:067 UTC] WebContainer:0/1/22/50
[4/6/26 4:32:32:082 UTC] WebContainer:0/1/22/50
[4/6/26 4:35:32:090 UTC] WebContainer:0/1/22/50
[4/6/26 4:38:32:098 UTC] WebContainer:0/1/22/50
[4/6/26 4:41:32:109 UTC] WebContainer:0/1/22/50
[4/6/26 4:44:32:119 UTC] WebContainer:0/1/22/50
[4/6/26 4:47:32:128 UTC] WebContainer:0/1/22/50
[4/6/26 4:50:32:137 UTC] WebContainer:0/1/22/50
[4/6/26 4:53:32:151 UTC] WebContainer:0/1/22/50
[4/6/26 4:56:32:161 UTC] WebContainer:0/1/22/50
[4/6/26 4:59:32:173 UTC] WebContainer:0/1/22/50
[4/6/26 5:02:32:181 UTC] WebContainer:0/1/22/50
参考
IBM WebSphere Application Server Performance Cookbook - Thread Poolsの「Thread Pool Statistics」