モニタリング項目とは、最も一般的な診断・監視情報であり、特定の計測値を指します。例えば、実行されるSQL数、実行時間、I/O数などです。OceanBaseデータベースには現在、ネットワーク、リクエストキュー、トランザクション、SQL、キャッシュ、ストレージ、リソースクォータ、ログなど、すべての重要な実行情報を網羅する14の大カテゴリ、600以上のモニタリング項目が用意されています。これらのモニタリング項目のうち、一部の指標ではリアルタイム性が高い(例えば、QPS、TPS、QPS_RT、TPS_RT、Active_sessionsなど)ため、OceanBaseデータベースはこれらの情報に対して秒単位での収集をサポートしています。その他の情報については、分単位での収集が可能です。
モニタリング項目のデータはGV$SYSSTATビューから取得され、主なフィールドの説明は以下の通りです:
CON_ID:テナントID。SVR_IP:ノードIPアドレス。STAT_ID:モニタリング項目ID。NAME:モニタリング項目名。CLASS:モニタリング項目のカテゴリ。VALUE:モニタリング項目の値。VALUE_TYPE:モニタリング項目の値の型。
CLASSはモニタリング項目のカテゴリを示しており、OceanBaseデータベースV4.xでは主に以下の14の大カテゴリが含まれます。具体的には以下の通りです:
| モニタリング項目カテゴリ | モニタリング項目カテゴリ名 |
|---|---|
| 1 | ネットワーク |
| 2 | リクエストキュー |
| 4 | トランザクション |
| 8 | SQL |
| 16 | キャッシュ |
| 32 | ストレージ |
| 64 | リソース |
| 128 | ログ |
| 256 | CLOG |
| 512 | 選挙 |
| 1024 | OBServer |
| 2048 | Root Service |
| 3072 | Analyze Report |
| 4096 | TableAPI |
STAT_IDとNAMEはそれぞれモニタリング項目IDとモニタリング項目名を示しています。例えば、SQLの大カテゴリに属するすべてのモニタリング項目は以下のようになります:
obclient> SELECT CLASS,STAT_ID,NAME,VALUE_TYPE FROM GV$SYSSTAT WHERE CLASS=8;
実行結果は次のとおりです:
+-------+---------+------------------------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+------------------------------------+------------+
| 8 | 40000 | sql select count | ADD_VALUE |
| 8 | 40001 | sql select time | ADD_VALUE |
| 8 | 40002 | sql insert count | ADD_VALUE |
| 8 | 40003 | sql insert time | ADD_VALUE |
| 8 | 40004 | sql replace count | ADD_VALUE |
| 8 | 40005 | sql replace time | ADD_VALUE |
| 8 | 40006 | sql update count | ADD_VALUE |
| 8 | 40007 | sql update time | ADD_VALUE |
| 8 | 40008 | sql delete count | ADD_VALUE |
| 8 | 40009 | sql delete time | ADD_VALUE |
| 8 | 40018 | sql other count | ADD_VALUE |
| 8 | 40019 | sql other time | ADD_VALUE |
| 8 | 40020 | ps prepare count | ADD_VALUE |
| 8 | 40021 | ps prepare time | ADD_VALUE |
| 8 | 40022 | ps execute count | ADD_VALUE |
| 8 | 40023 | ps close count | ADD_VALUE |
| 8 | 40024 | ps close time | ADD_VALUE |
| 8 | 40025 | sql commit count | ADD_VALUE |
| 8 | 40026 | sql commit time | ADD_VALUE |
| 8 | 40027 | sql rollback count | ADD_VALUE |
| 8 | 40028 | sql rollback time | ADD_VALUE |
| 8 | 40030 | opened cursors current | ADD_VALUE |
| 8 | 40031 | opened cursors cumulative | ADD_VALUE |
| 8 | 40010 | sql local count | ADD_VALUE |
| 8 | 40011 | sql remote count | ADD_VALUE |
| 8 | 40012 | sql distributed count | ADD_VALUE |
| 8 | 40013 | active sessions | ADD_VALUE |
| 8 | 40014 | single query count | ADD_VALUE |
| 8 | 40015 | multiple query count | ADD_VALUE |
| 8 | 40016 | multiple query with one stmt count | ADD_VALUE |
| 8 | 40100 | sql inner select count | ADD_VALUE |
| 8 | 40101 | sql inner select time | ADD_VALUE |
| 8 | 40102 | sql inner insert count | ADD_VALUE |
| 8 | 40103 | sql inner insert time | ADD_VALUE |
| 8 | 40104 | sql inner replace count | ADD_VALUE |
| 8 | 40105 | sql inner replace time | ADD_VALUE |
| 8 | 40106 | sql inner update count | ADD_VALUE |
| 8 | 40107 | sql inner update time | ADD_VALUE |
| 8 | 40108 | sql inner delete count | ADD_VALUE |
| 8 | 40109 | sql inner delete time | ADD_VALUE |
| 8 | 40110 | sql inner other count | ADD_VALUE |
| 8 | 40111 | sql inner other time | ADD_VALUE |
| 8 | 40112 | user logons cumulative | ADD_VALUE |
| 8 | 40113 | user logouts cumulative | ADD_VALUE |
| 8 | 40114 | user logons failed cumulative | ADD_VALUE |
| 8 | 40115 | user logons time cumulative | ADD_VALUE |
| 8 | 40116 | sql local execute time | ADD_VALUE |
| 8 | 40117 | sql remote execute time | ADD_VALUE |
| 8 | 40118 | sql distributed execute time | ADD_VALUE |
| 8 | 40119 | sql fail count | ADD_VALUE |
| 8 | 40120 | inner sql local count | ADD_VALUE |
| 8 | 40121 | inner sql remote count | ADD_VALUE |
| 8 | 40122 | inner sql distributed count | ADD_VALUE |
+-------+---------+------------------------------------+------------+
42 rows in set (0.07 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| sql select count | SELECT文の実行回数 |
| sql select time | SELECT文の実行総時間、単位はマイクロ秒 |
| sql insert count | INSERT文の実行回数 |
| sql insert time | INSERT文の実行総時間、単位はマイクロ秒 |
| sql replace count | REPLACE文の実行回数 |
| sql replace time | REPLACE文の実行総時間、単位はマイクロ秒 |
| sql update count | UPDATE文の実行回数 |
| sql update time | UPDATE文の実行総時間、単位はマイクロ秒 |
| sql delete count | DELETE文の実行回数 |
| sql delete time | DELETE文の実行総時間、単位はマイクロ秒 |
| sql other count | その他の文の実行回数 |
| sql other time | その他の文の実行総時間、単位はマイクロ秒 |
| ps prepare count | PS準備カウント |
| ps prepare time | PS準備時間、単位はマイクロ秒 |
| ps execute count | PS実行カウント |
| ps close count | PS閉じカウント |
| ps close time | PS閉じ時間、単位はマイクロ秒 |
| sql commit count | コミット回数 |
| sql commit time | コミット時間、単位はマイクロ秒 |
| sql rollback count | ロールバック回数 |
| sql rollback time | ロールバック時間 |
| opened cursors current | 現在起動中のカーソル(OCPがセッションキャッシュとして使用するカーソル数) |
| opened cursors cumulative | 起動したカーソルの累計数 |
| sql local count | LOCAL文の実行回数 |
| sql remote count | REMOTE文の実行回数 |
| sql distributed count | DISTRIBUTED文の実行回数 |
| active sessions | アクティブ接続数 |
| single query count | 単一クエリのカウント |
| multiple query count | Multiple Queryプロトコルで送信された文の総数 |
| sql inner select count | inner sql SELECT文の実行回数 |
| sql inner select time | inner sql SELECT文の実行総時間、単位はマイクロ秒 |
| sql inner insert count | inner sql INSERT文の実行回数 |
| sql inner insert time | inner sql INSERT文の実行総時間、単位はマイクロ秒 |
| sql inner replace count | inner sql REPLACE文の実行回数 |
| sql inner replace time | inner sql REPLACE文の実行総時間、単位はマイクロ秒 |
| sql inner update count | inner sql UPDATE文の実行回数 |
| sql inner update time | inner sql UPDATE文の実行総時間、単位はマイクロ秒 |
| sql inner delete count | inner sql DELETE文の実行回数 |
| sql inner delete time | inner sql DELETE文の実行総時間、単位はマイクロ秒 |
| sql inner other count | inner sql OTHER文の実行総時間、単位はマイクロ秒 |
| sql inner other time | inner sql OTHER文の実行総時間、単位はマイクロ秒 |
| user logons cumulative | ユーザーログオン累計 |
| user logouts cumulative | ユーザーログアウト累計 |
| user logons failed cumulative | ユーザーログオン失敗累計数 |
| user logons time cumulative | ユーザーログオン時間累計 |
| sql local execute time | ローカルデータベースノードでのSQLクエリ実行時間。単位はマイクロ秒。 |
| sql remote execute time | リモートノードでのSQLクエリ実行時間。単位はマイクロ秒。 |
| sql distributed execute time | ブロックトランザクションまたは複数ノード間で協調的に実行されるSQLの合計実行時間。単位はマイクロ秒。 |
| sql fail count | SQL実行失敗回数 |
| inner sql local count | 内部生成されたローカルSQLの実行回数 |
| inner sql remote count | 内部生成されたリモート実行が必要なSQLの回数 |
| inner sql distributed count | 内部生成された分散協調実行が必要なSQLの回数 |
その中でも特にリアルタイム性が求められる一部のモニタリング項目については、秒単位での収集がサポートされています。例えば、QPS、TPS、QPS_RT、TPS_RTなどです。
CON_IDとSVR_IPはモニタリング項目の対象を示しており、異なるシナリオにおいて柔軟にモニタリング指標を集計することができます。例えば、テナントのリクエスト量の変化を観察する場合、CON_IDに基づいてQPSやTPSの指標を集計することができます。ノードのリクエスト量の変化を観察する場合、SVR_IPに基づいてQPSやTPSの指標を集計することができます。また、クラスタのロードバランシングを行う際には、CON_ID + SVR_IPに基づいてUnit単位のQPSやTPSの指標を集計することができます。
VALUE_TYPEはモニタリング項目の値の型を示しており、値としてADD_VALUEとSET_VALUEがあり、それぞれ累積型と状態型に対応します。累積型のモニタリング項目については、データベースが内部で計測を行う際に常に累積されます。例えば、sql count、sql rt、io read bytesなどです。外部のモニタリングシステムは定期的にこれらの累積型モニタリング項目を取得し、差分を計算してこれらのモニタリング項目のデータ変化傾向を表示します。状態型のモニタリング項目については、データベースが内部で計測を行う際にモニタリング項目の最新値を維持します。例えば、cache size、cpu usageなどです。外部のモニタリングシステムは定期的にこれらの状態型モニタリング項目を取得し、そのまま表示します。一般的に、状態型モニタリング項目はテナントレベルでの集計のみが可能ですが、ほとんどの累積型モニタリング項目はセッションレベルとテナントレベルの両方で集計をサポートしています。
モニタリング項目が記述するコンポーネントによって、14の大カテゴリに分類されます。ここでは、頻繁に使用されるモニタリング項目について重点的に紹介します。
ネットワーク
以下の例を使用して、ネットワーク関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=1 and stat_id in (10000,10001,10002,10003,10004,10005,10006);
実行結果は次のとおりです:
+-------+---------+----------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+----------------------+------------+
| 1 | 10000 | rpc packet in | ADD_VALUE |
| 1 | 10001 | rpc packet in bytes | ADD_VALUE |
| 1 | 10002 | rpc packet out | ADD_VALUE |
| 1 | 10003 | rpc packet out bytes | ADD_VALUE |
| 1 | 10004 | rpc deliver fail | ADD_VALUE |
| 1 | 10005 | rpc net delay | ADD_VALUE |
| 1 | 10006 | rpc net frame delay | ADD_VALUE |
+-------+---------+----------------------+------------+
7 rows in set (0.06 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| rpc packet in | このOBServerに送信されたRPCパケットの累計数 |
| rpc packet in bytes | このOBServerに送信されたRPCパケットの累計バイト数 |
| rpc packet out | このOBServerから送信されたRPCパケットの累計数 |
| rpc packet out bytes | このOBServerから送信されたRPCパケットの累計バイト数 |
| rpc deliver fail | パケット配布に失敗した累計数 |
| rpc net delay | RPC配布時のネットワーク遅延、すなわち受信時間から送信時間を差し引いた値。単位はマイクロ秒 |
| rpc net frame delay | RPC配布時のRPCフレーム遅延。単位はマイクロ秒 |
リクエストキュー
以下の例を参照して、リクエストキュー関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=2 and stat_id in (20000,20001,20002);
実行結果は次のとおりです:
+-------+---------+-----------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+-----------------------+------------+
| 2 | 20000 | request enqueue count | ADD_VALUE |
| 2 | 20001 | request dequeue count | ADD_VALUE |
| 2 | 20002 | request queue time | ADD_VALUE |
+-------+---------+-----------------------+------------+
3 rows in set (0.07 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| request enqueue count | テナントの待機キューに正常に追加されたリクエストの累計数 |
| request dequeue count | テナントのキューからPOP操作に成功したリクエストの累計数 |
| request queue time | リクエストが受信されて処理およびキューイングまでの累計時間、すなわち待機終了時間からキューへの追加時間を差し引いたもの。単位はマイクロ秒 |
トランザクション
以下の例を使用して、トランザクション関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=4 and stat_id in (30000,30001,30002,30005,30006,30007,30008,30009,30010,30011,30012,30013,30200,30201,30202,30203,30204,30205,30206,30207,30208,30209,30210,30211,30212,30213,30214,30215,30216,30217,30218,30219);
実行結果は次のとおりです:
+-------+---------+----------------------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+----------------------------------+------------+
| 4 | 30000 | trans commit log sync time | ADD_VALUE |
| 4 | 30001 | trans commit log sync count | ADD_VALUE |
| 4 | 30002 | trans commit log submit count | ADD_VALUE |
| 4 | 30005 | trans start count | ADD_VALUE |
| 4 | 30006 | trans total used time | ADD_VALUE |
| 4 | 30007 | trans commit count | ADD_VALUE |
| 4 | 30008 | trans commit time | ADD_VALUE |
| 4 | 30009 | trans rollback count | ADD_VALUE |
| 4 | 30010 | trans rollback time | ADD_VALUE |
| 4 | 30011 | trans timeout count | ADD_VALUE |
| 4 | 30012 | trans local trans count | ADD_VALUE |
| 4 | 30013 | trans distribute trans count | ADD_VALUE |
| 4 | 30200 | xa start total count | ADD_VALUE |
| 4 | 30201 | xa start total used time | ADD_VALUE |
| 4 | 30202 | xa start with rpc total count | ADD_VALUE |
| 4 | 30203 | failed xa start total count | ADD_VALUE |
| 4 | 30204 | xa end total count | ADD_VALUE |
| 4 | 30205 | xa end total used count | ADD_VALUE |
| 4 | 30206 | xa end with rpc total count | ADD_VALUE |
| 4 | 30207 | failed xa end total count | ADD_VALUE |
| 4 | 30208 | xa prepare total count | ADD_VALUE |
| 4 | 30209 | xa prepare total used time | ADD_VALUE |
| 4 | 30210 | xa prepare with rpc total count | ADD_VALUE |
| 4 | 30211 | failed xa prepare total count | ADD_VALUE |
| 4 | 30212 | xa commit total count | ADD_VALUE |
| 4 | 30213 | xa commit total used time | ADD_VALUE |
| 4 | 30214 | xa commit with rpc total count | ADD_VALUE |
| 4 | 30215 | failed xa commit total count | ADD_VALUE |
| 4 | 30216 | xa rollback total count | ADD_VALUE |
| 4 | 30217 | xa rollback total used time | ADD_VALUE |
| 4 | 30218 | xa rollback with rpc total count | ADD_VALUE |
| 4 | 30219 | failed xa rollback total count | ADD_VALUE |
+-------+---------+----------------------------------+------------+
32 rows in set (0.013 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| trans commit log sync time | Commit Log同期の多数派の総時間、単位はマイクロ秒 |
| trans commit log sync count | Commit Logの総数 |
| trans commit log submit count | テナントがコミットしたトランザクションログ数 |
| trans start count | テナントの開始トランザクション数 |
| trans total used time | テナントトランザクションの総使用時間、単位はマイクロ秒 |
| trans commit count | トランザクションのCommit回数 |
| trans commit time | トランザクションのCommit段階で消費された時間、単位はマイクロ秒 |
| trans rollback count | トランザクションのロールバック量 |
| trans rollback time | トランザクションのロールバック段階で消費された時間、単位はマイクロ秒 |
| trans timeout count | タイムアウトトランザクション数 |
| trans local trans count | Localトランザクション数 |
| trans distribute trans count | 分散トランザクション数 |
| xa start total count | xa_start ステートメントの総数(成功および失敗を含む) |
| xa start total used time | xa_start ステートメントの総時間(成功および失敗を含む)、単位はマイクロ秒 |
| xa start with rpc total count | リモート xa_start ステートメントの総数(成功のみを含む) |
| failed xa start total count | xa_start ステートメントの失敗総数 |
| xa end total count | xa_end ステートメントの総数、成功と失敗を含む |
| xa end total used count | xa_end ステートメントの総時間、成功と失敗を含む、単位はマイクロ秒 |
| xa end with rpc total count | リモート xa_end ステートメントの総数(成功のみを含む) |
| failed xa end total count | xa_end ステートメントの失敗総数 |
| xa prepare total count | xa_prepare ステートメントの総数(成功および失敗を含む) |
| xa prepare total used time | xa_prepare ステートメントの総時間(成功および失敗を含む)、単位はマイクロ秒 |
| xa prepare with rpc total count | リモート xa_prepare ステートメントの総数(成功のみを含む) |
| failed xa prepare total count | xa_prepare ステートメントの失敗総数 |
| xa commit total count | xa_commit ステートメントの総数(成功および失敗を含む) |
| xa commit total used time | xa_commit ステートメントの総時間(成功および失敗を含む)、単位はマイクロ秒 |
| xa commit with rpc total count | リモート xa_commit ステートメントの総数(成功のみを含む) |
| failed xa commit total count | xa_commit ステートメントの失敗総数 |
| xa rollback total count | xa_rollback ステートメントの総数(成功および失敗を含む) |
| xa rollback total used time | xa_rollback ステートメントの総時間(成功および失敗を含む)、単位はマイクロ秒 |
| xa rollback with rpc total count | リモート xa_rollback ステートメントの総数(成功のみを含む) |
| failed xa rollback total count | xa_rollback ステートメントの失敗総数 |
SQL
以下の例を参照して、SQL関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=8 and stat_id in (40000, 40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010, 40011, 40012, 40018, 40019);
実行結果は次のとおりです:
+-------+---------+-----------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+-----------------------+------------+
| 8 | 40000 | sql select count | ADD_VALUE |
| 8 | 40001 | sql select time | ADD_VALUE |
| 8 | 40002 | sql insert count | ADD_VALUE |
| 8 | 40003 | sql insert time | ADD_VALUE |
| 8 | 40004 | sql replace count | ADD_VALUE |
| 8 | 40005 | sql replace time | ADD_VALUE |
| 8 | 40006 | sql update count | ADD_VALUE |
| 8 | 40007 | sql update time | ADD_VALUE |
| 8 | 40008 | sql delete count | ADD_VALUE |
| 8 | 40009 | sql delete time | ADD_VALUE |
| 8 | 40018 | sql other count | ADD_VALUE |
| 8 | 40019 | sql other time | ADD_VALUE |
| 8 | 40010 | sql local count | ADD_VALUE |
| 8 | 40011 | sql remote count | ADD_VALUE |
| 8 | 40012 | sql distributed count | ADD_VALUE |
+-------+---------+-----------------------+------------+
15 rows in set (0.08 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| sql select count | SELECT文の実行回数 |
| sql select time | SELECT文の実行総時間、単位はマイクロ秒 |
| sql insert count | INSERT文の実行回数 |
| sql insert time | INSERT文の実行総時間、単位はマイクロ秒 |
| sql replace count | REPLACE文の実行回数 |
| sql replace time | REPLACE文の実行総時間、単位はマイクロ秒 |
| sql update count | UPDATE文の実行回数 |
| sql update time | UPDATE文の実行総時間、単位はマイクロ秒 |
| sql delete count | DELETE文の実行回数 |
| sql delete time | DELETE文の実行総時間、単位はマイクロ秒 |
| sql other count | その他の文の実行回数 |
| sql other time | その他の文の実行総時間 |
| sql local count | LOCAL文の実行回数 |
| sql remote count | REMOTE文の実行回数 |
| sql distributed count | DISTRIBUTED文の実行回数 |
KVCache
以下の例を参照して、KVCache関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=16 and stat_id in (50000, 50001, 50004, 50005, 50008, 50009, 50010, 50011, 50037, 50038,120000,120001,120008,120009);
実行結果は次のとおりです:
+-------+---------+-------------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+-------------------------+------------+
| 16 | 50000 | row cache hit | ADD_VALUE |
| 16 | 50001 | row cache miss | ADD_VALUE |
| 16 | 50004 | bloom filter cache hit | ADD_VALUE |
| 16 | 50005 | bloom filter cache miss | ADD_VALUE |
| 16 | 50008 | block cache hit | ADD_VALUE |
| 16 | 50009 | block cache miss | ADD_VALUE |
| 16 | 50010 | location cache hit | ADD_VALUE |
| 16 | 50011 | location cache miss | ADD_VALUE |
| 16 | 50037 | tablet ls cache hit | ADD_VALUE |
| 16 | 50038 | tablet ls cache miss | ADD_VALUE |
| 16 | 120000 | location cache size | SET_VALUE |
| 16 | 120001 | tablet ls cache size | SET_VALUE |
| 16 | 120008 | user row cache size | SET_VALUE |
| 16 | 120009 | bloom filter cache size | SET_VALUE |
+-------+---------+-------------------------+------------+
14 rows in set (0.07 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| row cache hit | row cacheヒット回数 |
| row cache miss | row cacheミス回数 |
| bloom filter cache hit | bloom filter cacheヒット回数 |
| bloom filter cache miss | bloom filter cacheミス回数 |
| block cache hit | Block Cacheヒット回数 |
| block cache miss | Block Cacheミス回数 |
| location cache hit | Location Cacheヒット回数 |
| location cache miss | Location Cacheミス回数 |
| tablet ls cache hit | キャッシュヒット |
| tablet ls cache miss | キャッシュMISS |
| location cache size | Locationキャッシュサイズ |
| tablet ls cache size | clogキャッシュサイズ |
| user row cache size | ユーザー行レベルキャッシュサイズ |
| bloom filter cache size | Bloom Filterキャッシュサイズ |
GV$SYSSTATビューは、KVCacheのヒット率を記述しています。KVCacheの各モジュールの実際のメモリ使用量をさらに詳しく調べるには、GV$OB_KVCACHEビューを照会します。例えば:
obclient> select DBA_OB_TENANTS.tenant_id,tenant_name, svr_ip,svr_port, cache_name, cache_size
from GV$OB_KVCACHE, DBA_OB_TENANTS where DBA_OB_TENANTS.tenant_type!='META' and DBA_OB_TENANTS.tenant_id = GV$OB_KVCACHE.tenant_id limit 10;
実行結果は次のとおりです:
+-----------+----------------+------------+----------+-----------------------+------------+
| tenant_id | tenant_name | svr_ip | svr_port | cache_name | cache_size |
+-----------+----------------+------------+----------+-----------------------+------------+
| 1 | sys |xx.xx.xx.xx | 2882 | schema_cache | 14564352 |
| 1 | sys |xx.xx.xx.xx | 2882 | tablet_table_cache | 6241280 |
| 1 | sys |xx.xx.xx.xx | 2882 | vtable_cache | 35372032 |
| 1 | sys |xx.xx.xx.xx | 2882 | opt_column_stat_cache | 6241280 |
| 1008 | mq_t1 |xx.xx.xx.xx | 2882 | index_block_cache | 6241280 |
| 1008 | mq_t1 |xx.xx.xx.xx | 2882 | user_block_cache | 10402816 |
| 1008 | mq_t1 |xx.xx.xx.xx | 2882 | user_row_cache | 6241280 |
| 1010 | oracle_tenant1 |xx.xx.xx.xx | 2882 | index_block_cache | 6241280 |
| 1008 | mq_t1 |xx.xx.xx.xx | 2882 | bf_cache | 4160512 |
| 1010 | oracle_tenant1 |xx.xx.xx.xx | 2882 | user_block_cache | 8322048 |
+-----------+----------------+------------+----------+-----------------------+------------+
10 rows in set (0.06 sec)
ストレージ
以下の例を使用して、ストレージ関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=32 and stat_id in (60000, 60001, 60002, 60003, 60004, 60005, 60019, 60020, 60021, 60022, 60023, 60024,130000,130001,130002,130004);
実行結果は次のとおりです:
+-------+---------+--------------------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+--------------------------------+------------+
| 32 | 60000 | io read count | ADD_VALUE |
| 32 | 60001 | io read delay | ADD_VALUE |
| 32 | 60002 | io read bytes | ADD_VALUE |
| 32 | 60003 | io write count | ADD_VALUE |
| 32 | 60004 | io write delay | ADD_VALUE |
| 32 | 60005 | io write bytes | ADD_VALUE |
| 32 | 60019 | memstore read lock succ count | ADD_VALUE |
| 32 | 60020 | memstore read lock fail count | ADD_VALUE |
| 32 | 60021 | memstore write lock succ count | ADD_VALUE |
| 32 | 60022 | memstore write lock fail count | ADD_VALUE |
| 32 | 60023 | memstore wait write lock time | ADD_VALUE |
| 32 | 60024 | memstore wait read lock time | ADD_VALUE |
| 32 | 130000 | active memstore used | SET_VALUE |
| 32 | 130001 | total memstore used | SET_VALUE |
| 32 | 130002 | major freeze trigger | SET_VALUE |
| 32 | 130004 | memstore limit | SET_VALUE |
+-------+---------+--------------------------------+------------+
16 rows in set (0.06 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| io read count | I/O読み取り回数 |
| io read delay | I/O読み取り遅延 |
| io read bytes | I/O読み取りバイト数 |
| io write count | I/O書き込み回数 |
| io write delay | I/O書き込み遅延 |
| io write bytes | I/O書き込みバイト数 |
| memstore read lock succ count | 行に対するスナップショット読み取りチェックが成功した回数 |
| memstore read lock fail count | 行に対するスナップショット読み取りチェックが失敗した回数 |
| memstore write lock succ count | MemStore行追加ロックが成功した回数 |
| memstore write lock fail count | MemStore行追加ロックが失敗した回数 |
| memstore wait write lock time | 行ロックの待機時間、単位はマイクロ秒 |
| memstore wait read lock time | スナップショット読み取りの待機時間、単位はマイクロ秒 |
| active memstore used | Active MemStore使用値(過大になる場合あり) |
| total memstore used | 総MemStore使用値 |
| major freeze trigger | MAJOR FREEZEしきい値をトリガー |
| memstore limit | MemStoreで使用可能な最大メモリ値 |
リソース
以下の例を参照して、リソース関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=64 and stat_id in (140002,140003,140005,140006);
実行結果は次のとおりです:
+-------+---------+-----------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+-----------------+------------+
| 64 | 140002 | max memory size | SET_VALUE |
| 64 | 140003 | memory usage | SET_VALUE |
| 64 | 140005 | max cpus | SET_VALUE |
| 64 | 140006 | cpu usage | SET_VALUE |
+-------+---------+-----------------+------------+
4 rows in set (0.06 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| max memory size | テナントの最大メモリ制限 |
| memory usage | テナントの現在のメモリ使用量 |
| min cpus | このテナントのUNIT_CONFIGにおけるmin_cpu *100 |
| max cpus | このテナントのUNIT_CONFIGにおけるmax_cpu *100 |
| cpu usage | ロジックCPU利用率。例えば、148は148%を表し、このテナントが複数のロジックCPUコアを使用していることを示します |
上記のモニタリング項目に基づいて、テナントのCPU利用率とメモリ利用率を容易に取得できます。
テナントCPU利用率 = cpu usage (stat_id = 140013) / max cpus (stat_id = 140005)
テナントスレッド利用率 = cpu usage (stat_id = 140006) / max cpus (stat_id = 140005)
テナントメモリ利用率 = memory usage (stat_id = 140003) / max memory size (stat_id = 140002)
CLOG
以下の例を参照して、CLOG関連のモニタリングメトリクスを照会できます。
obclient> select distinct class,stat_id,name,VALUE_TYPE from gv$sysstat where class=256 and stat_id in (80040,80041,80057);
実行結果は次のとおりです:
+-------+---------+---------------------------+------------+
| class | stat_id | name | VALUE_TYPE |
+-------+---------+---------------------------+------------+
| 256 | 80040 | clog write count | ADD_VALUE |
| 256 | 80041 | clog write time | ADD_VALUE |
| 256 | 80057 | clog trans log total size | ADD_VALUE |
+-------+---------+---------------------------+------------+
3 rows in set (0.07 sec)
パラメータの説明:
| NAME | 説明 |
|---|---|
| clog write count | clog書き込み回数 |
| clog write time | clog書き込み時間 |
| clog trans log total size | コミットされたトランザクションログの合計サイズ |
time model
以下の例を使用して、time model関連のモニタリングメトリクスを照会できます。
obclient> select * from oceanbase.V$STATNAME where class = 3072;
実行結果は次のとおりです:
+--------+---------+------------+----------------------------------------+----------------------------------------+-------+
| CON_ID | STAT_ID | STATISTIC# | NAME | DISPLAY_NAME | CLASS |
+--------+---------+------------+----------------------------------------+----------------------------------------+-------+
| 1002 | 200001 | 368 | DB time | DB time | 3072 |
| 1002 | 200002 | 369 | DB CPU | DB CPU | 3072 |
| 1002 | 200005 | 370 | background elapsed time | background elapsed time | 3072 |
| 1002 | 200006 | 371 | background cpu time | background cpu time | 3072 |
| 1002 | 200010 | 372 | non idle wait time | non idle wait time | 3072 |
| 1002 | 200011 | 373 | idle wait time | idle wait time | 3072 |
| 1002 | 200012 | 374 | background database time | background database time | 3072 |
| 1002 | 200013 | 375 | background database non-idle wait time | background database non-idle wait time | 3072 |
| 1002 | 200014 | 376 | background database idle wait time | background database idle wait time | 3072 |
| 1002 | 220001 | 388 | concurrency wait total time | concurrency wait total time | 3072 |
| 1002 | 220002 | 389 | user io wait total time | user io wait total time | 3072 |
| 1002 | 220003 | 390 | application wait total time | application wait total time | 3072 |
+--------+---------+------------+----------------------------------------+----------------------------------------+-------+
12 rows in set (0.184 sec)
パラメータの説明:
注意
background を含まないメトリクスは、background部分を含みません。たとえば、idle wait time はフロントエンドセッションに関連する時間のみを記録し、background database idle wait time に関連する内容は含まれません。これら2つのメトリクスの統計値は排他的です。
| NAME | 説明 |
|---|---|
| DB time | データベースアクティビティの合計時間。CPUおよび非アイドル待機時間の累積値を含み、単位はマイクロ秒です |
| DB CPU | データベースアクティビティにおけるCPU消費時間、単位はマイクロ秒です |
| background elapsed time | バックグラウンドプロセスの実行合計時間、単位はマイクロ秒です |
| background cpu time | バックグラウンドプロセスが消費したCPU時間、単位はマイクロ秒です |
| non idle wait time | 非アイドル待機時間、つまりセッションが待機状態にあるが、アイドル待機ではない合計時間、単位はマイクロ秒です |
| idle wait time | アイドル待機時間、つまりセッションがアイドル待機状態にある合計時間、単位はマイクロ秒です |
| background database time | バックグラウンドプロセスによるデータベース操作の実行合計時間、単位はマイクロ秒です |
| background database non-idle wait time | バックグラウンドプロセスが非アイドル待機状態でデータベース操作を実行した時間、単位はマイクロ秒です |
| background database idle wait time | バックグラウンドプロセスがアイドル待機状態でデータベース操作を実行した時間、単位はマイクロ秒です |
| concurrency wait total time | 並行処理による待機時間の合計。例えば、リソースロックによる待機時間など、単位はマイクロ秒です |
| user io wait total time | ユーザープロセスがI/O操作(データの読み取りやディスクへの書き込みなど)の完了を待機している合計時間、単位はマイクロ秒です |
| application wait total time | ユーザーアプリケーションコードによって発生する待機時間の合計(例えば、行レベルロックや明示的ロックコマンドによるロック待機など)、単位はマイクロ秒です |
その他
GV$SYSSTATビューに加えて、モニタリング項目をさまざまな観点から説明する豊富なビューがあります。
たとえば、GV$OB_PROCESSLISTビューは、システムの現在のセッションをアクティブ状態を含めて説明し、実行されるSQL文も含まれます。また、SID、SQL_ID、TRANS_ID、TRACE_IDなどの重要なフィールドも含まれており、フルリンクトレースの強力なツールです。
GV$OB_PROCESSLISTビューに基づいてアクティブセッションを照会します:obclient> select TENANT,SVR_IP,SVR_PORT,USER,HOST,COMMAND,STATE,INFO,SQL_ID,TRACE_ID from GV$OB_PROCESSLIST where STATE='ACTIVE' or null limit 10;実行結果は次のとおりです:
+--------+------------+----------+-----------+-------------------+---------+--------+-----------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-----------------------------------+ | TENANT | SVR_IP | SVR_PORT | USER | HOST | COMMAND | STATE | INFO | SQL_ID | TRACE_ID | +--------+------------+----------+-----------+-------------------+---------+--------+-----------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-----------------------------------+ | sys |xx.xx.xx.xx | 2882 | DBA_query | xx.xx.xx.xx:51588 | Query | ACTIVE | select TENANT,SVR_IP,SVR_PORT,USER,HOST,COMMAND,STATE,INFO,SQL_ID,TRACE_ID from GV$OB_PROCESSLIST where STATE='ACTIVE' or null limit 10 | D18F6AE855AD0D7478162DD8EF48C781 | YB4206008451-0005F55893CEA363-0-0 | +--------+------------+----------+-----------+-------------------+---------+--------+-----------------------------------------------------------------------------------------------------------------------------------------+----------------------------------+-----------------------------------+ 1 row in set (0.04 sec)GV$OB_PROCESSLISTビューに基づいてユニット単位のアクティブセッション数を照会します:obclient> select tenant_id, tenant_name, svr_ip, case when cnt is null then 0 else cnt end as cnt from ( select DBA_OB_TENANTS.tenant_name, DBA_OB_TENANTS.tenant_id, svr_ip, cnt from DBA_OB_TENANTS left join ( select count(`state`='ACTIVE' OR NULL) as cnt, tenant as tenant_name, svr_ip from GV$OB_PROCESSLIST group by tenant,svr_ip ) t1 on DBA_OB_TENANTS.tenant_name = t1.tenant_name where DBA_OB_TENANTS.tenant_type!='META' ) t2;実行結果は次のとおりです:
+-----------+-----------------+-------------+------+ | tenant_id | tenant_name | svr_ip | cnt | +-----------+-----------------+-------------+------+ | 1 | sys | xx.xx.xx.xx | 0 | | 1 | sys | xx.xx.xx.xx | 0 | | 1 | sys | xx.xx.xx.xx | 0 | | 1002 | midas0_3790 | xx.xx.xx.xx | 0 | | 1002 | midas0_3790 | xx.xx.xx.xx | 0 | | 1002 | midas0_3790 | xx.xx.xx.xx | 0 | +-----------+-----------------+-------------+------+ 6 rows in set (0.05 sec)