[スレッド・プールのカウンター - IBM Documentation]
( https://www.ibm.com/docs/ja/was-nd/8.5.5?topic=organization-thread-pool-counters )
を取得します
[tWAS 9.0 と Db2 で DataSourceを使う #Java - Qiita]
( https://qiita.com/keniooi/items/70217218d07e49525c49 )
の環境で検証します。
1.コンテナに入ります
podman exec -it was90-db2 bash
2.wsadminツールにて管理ノードへ接続します
$ /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.sh
Realm/Cell Name: <default>
Username: wsadmin
Password:
WASX7209I: Connected to process "server1" on node DefaultNode01 using SOAP connector; The type of process is: UnManagedProcess
WASX7031I: For help, enter: "print Help.help()"
3.Perf MBeanを指定します。
wsadmin>perf = AdminControl.completeObjectName("type=Perf,process=server1,*")
wsadmin>perfObj = AdminControl.makeObjectName(perf)
4.WebContainerスレッドプールを指定します。
wsadmin>threadPoolName = AdminControl.completeObjectName('type=ThreadPool,name=WebContainer,*')
wsadmin>params = [AdminControl.makeObjectName(threadPoolName),java.lang.Boolean('false')]
wsadmin>sigs = ['javax.management.ObjectName', 'java.lang.Boolean']
5.MBeanのStatsを確認します。
wsadmin>webthdp = AdminControl.invoke_jmx(perfObj,'getStatsObject',params,sigs)
wsadmin>print webthdp
Stats name=WebContainer, type=threadPoolModule
{
name=ActiveCount, ID=3, description=The number of concurrently active threads., unit=N/A, type=BoundedRangeStatistic, lowWaterMark=0, highWaterMark=2, current=1, integral=33775.0, lowerBound=0, upperBound=0
name=PoolSize, ID=4, description=The average number of threads in a pool., unit=N/A, type=BoundedRangeStatistic, lowWaterMark=1, highWaterMark=50, current=2, integral=3228.0, lowerBound=50, upperBound=50
}
6.http://ホスト名:9080/db.connections/db に多重リクエストを送ってみます
% xargs -I % -P 20 curl -I "http://ホスト名:9080/db.connections/db" < <(printf '%s\n' {1..10})
HTTP/1.1 200 OK
X-Powered-By: Servlet/3.1
Content-Type: text/html; charset=ISO-8859-1
Content-Language: en-US
Set-Cookie: JSESSIONID=00000vhFUDL2rFox4pWWLYpP9ho:-1; Path=/; HttpOnly
Date: Wed, 11 Dec 2024 01:26:20 GMT
Expires: Thu, 01 Dec 1994 16:00:00 GMT
Cache-Control: no-cache="set-cookie, set-cookie2"
(以下省略)
7.もう一度MBeanのStatsを確認します。PoolSizeは2から11に増えていました。
wsadmin>print webthdp
Stats name=WebContainer, type=threadPoolModule
{
name=ActiveCount, ID=3, description=The number of concurrently active threads., unit=N/A, type=BoundedRangeStatistic, lowWaterMark=0, highWaterMark=11, current=11, integral=6.5274116E7, lowerBound=0, upperBound=0
name=PoolSize, ID=4, description=The average number of threads in a pool., unit=N/A, type=BoundedRangeStatistic, lowWaterMark=1, highWaterMark=50, current=11, integral=1.38530999E8, lowerBound=50, upperBound=50
}
wsadmin>print webthdp.getStatistic('PoolSize').getCurrent()
11
wsadmin>print webthdp.getStatistic('ActiveCount').getCurrent()
11