このセクションでは、OceanBaseテナントのパフォーマンスメトリクスである セッション数 について説明します。セッションとは、アプリケーションとデータベースとの接続を指します。このメトリクスは、テナントの現在のセッション数 (all_session) と現在のアクティブセッション数 (active_session) を集計しています。統計範囲を指定することで、単一ゾーンまたはOBServerノード上のテナントの セッション数 データを照会できます。
active_session
メトリクスの紹介
テナントの現在のアクティブセッション数。
メトリクスパラメータの説明
メトリクス項目 |
メトリック名 |
単位 |
|---|---|---|
| active_session | active_session | - |
計算式
sum(ob_active_session_num{@LABELS}) by (@GBLABELS)
SQL収集
OceanBase V4.0 より前のバージョン:
select t1.tenant_name, coalesce(t2.active_cnt, 0) as active_cnt, coalesce(t2.all_cnt, 0) as all_cnt from (select tenant_name from v$unit) t1 left join (select count(`state`='ACTIVE' OR NULL) as active_cnt, count(1) as all_cnt, tenant as tenant_name from __all_virtual_processlist where svr_ip = ? and svr_port = ? group by tenant) t2 on t1.tenant_name = t2.tenant_nameOceanBase V4.0 以降のバージョン:
select t1.tenant_name, coalesce(t2.active_cnt, 0) as active_cnt, coalesce(t2.all_cnt, 0) as all_cnt from (select tenant_name from dba_ob_tenants where tenant_type <> 'META') t1 left join (select count(`state`='ACTIVE' OR NULL) as active_cnt, count(1) as all_cnt, tenant as tenant_name from V$OB_PROCESSLIST where svr_ip = ? and svr_port = ? group by tenant) t2 on t1.tenant_name = t2.tenant_name
all_session
メトリクスの紹介
テナントの現在のセッション総数。
メトリクスパラメータの説明
メトリクス項目 |
メトリック名 |
単位 |
|---|---|---|
| all_session | all_session | - |
計算式
sum(ob_all_session_num{@LABELS}) by (@GBLABELS)
SQL収集
OceanBase V4.0 より前のバージョン:
select t1.tenant_name, coalesce(t2.active_cnt, 0) as active_cnt, coalesce(t2.all_cnt, 0) as all_cnt from (select tenant_name from v$unit) t1 left join (select count(`state`='ACTIVE' OR NULL) as active_cnt, count(1) as all_cnt, tenant as tenant_name from __all_virtual_processlist where svr_ip = ? and svr_port = ? group by tenant) t2 on t1.tenant_name = t2.tenant_nameOceanBase V4.0 以降のバージョン:
select t1.tenant_name, coalesce(t2.active_cnt, 0) as active_cnt, coalesce(t2.all_cnt, 0) as all_cnt from (select tenant_name from dba_ob_tenants where tenant_type <> 'META') t1 left join (select count(`state`='ACTIVE' OR NULL) as active_cnt, count(1) as all_cnt, tenant as tenant_name from V$OB_PROCESSLIST where svr_ip = ? and svr_port = ? group by tenant) t2 on t1.tenant_name = t2.tenant_name