今日はなにの日。

気になったこと勉強になったことのメモ。

今日は、SHOW ENGINE INNODB STATUSについての日。

目次

とある日

前回の記事のSHOW ENGINE INNODB STATUSの実行結果を調べて見ようと思います。

はじめに

SHOW ENGINE INNODB STATUS

SHOW ENGINE INNODB STATUSについては下記の前回の記事をご覧ください。

前回の記事

updraft.hatenadiary.com

SHOW ENGINE INNODB STATUS実行結果

dev.mysql.com

mysql> SHOW ENGINE INNODB STATUS\G;
*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
2021-06-27 05:52:55 140268869617408 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 48 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 1 srv_active, 0 srv_shutdown, 46 srv_idle
srv_master_thread log flush and writes: 0
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 10
OS WAIT ARRAY INFO: signal count 10
RW-shared spins 0, rounds 0, OS waits 0
RW-excl spins 0, rounds 0, OS waits 0
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 0.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 10761
Purge done for trx's n:o < 10758 undo n:o < 0 state: running but idle
History list length 3
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421743861513624, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421743861512768, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421743861511912, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
1401 OS file reads, 191 OS file writes, 32 OS fsyncs
5.90 reads/s, 17719 avg bytes/read, 3.50 writes/s, 0.42 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 3 buffer(s)
25.71 hash searches/s, 49.56 non-hash searches/s
---
LOG
---
Log sequence number          29224504
Log buffer assigned up to    29224504
Log buffer completed up to   29224504
Log written up to            29224504
Log flushed up to            29224504
Added dirty pages up to      29224504
Pages flushed up to          29224504
Last checkpoint at           29224504
11 log i/o's done, 0.19 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137035776
Dictionary memory allocated 382389
Buffer pool size   8192
Free buffers       7199
Database pages     989
Old database pages 385
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 847, created 142, written 154
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 977 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 989, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=1, Main thread ID=140268321892096 , state=sleeping
Number of rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
Number of system rows inserted 0, updated 315, deleted 0, read 4677
0.00 inserts/s, 6.56 updates/s, 0.00 deletes/s, 97.44 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 row in set (0.00 sec)

ERROR:
No query specified

Status

*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
2021-06-27 05:52:55 140268869617408 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 48 seconds

データを取得した情報が出力されています。

このセクションには、タイムスタンプ、モニター名、および1秒あたりの平均が基づいている秒数が表示されます。秒数は、現在の時刻からInnoDBモニター出力が最後に印刷された時刻までの経過時間です。

BACKGROUND THREAD

-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 1 srv_active, 0 srv_shutdown, 46 srv_idle
srv_master_thread log flush and writes: 0

バックグラウンドスレッドの情報が出力されています。

srv_master_threadメインバックグラウンドスレッドによって行わ行ショーの仕事。

srv_master_thread行は、メインのバックグラウンドスレッドによって実行された作業を示しています。

dev.mysql.com

SEMAPHORES

----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 10
OS WAIT ARRAY INFO: signal count 10
RW-shared spins 0, rounds 0, OS waits 0
RW-excl spins 0, rounds 0, OS waits 0
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 0.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx

フォマにまつわる同期処理の情報が出力されています。

  • このセクションでは、セマフォを待機しているスレッドと、スレッドがスピンまたはミューテックスまたはrw-lockセマフォの待機を必要とした回数に関する統計を報告します。セマフォを待機しているスレッドの数が多いのは、ディスクI / O、または内部の競合の問題が原因である可能性がありますInnoDB。競合は、クエリの高度な並列処理またはオペレーティングシステムのスレッドスケジューリングの問題が原因である可能性があります。innodb_thread_concurrency このような状況では、システム変数をデフォルト値よりも小さく設定すると 役立つ場合があります。このSpin rounds per wait 行は、ミューテックスを待機するOSごとのスピンロックラウンドの数を示しています。

    ミューテックスメトリックはによって報告され SHOW ENGINE INNODB MUTEXます。

www.percona.com

TRANSACTIONS

------------
TRANSACTIONS
------------
Trx id counter 10761
Purge done for trx's n:o < 10758 undo n:o < 0 state: running but idle
History list length 3
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421743861513624, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421743861512768, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
---TRANSACTION 421743861511912, not started
0 lock struct(s), heap size 1136, 0 row lock(s)

トランザクションにまつわる出力一覧。

このセクションでロック待機が報告されている場合は、アプリケーションでロックの競合が発生している可能性があります。この出力は、トランザクションデッドロックの理由を追跡するのにも役立ちます。

FILE I/O

--------
FILE I/O
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
1401 OS file reads, 191 OS file writes, 32 OS fsyncs
5.90 reads/s, 17719 avg bytes/read, 3.50 writes/s, 0.42 fsyncs/s

ファイル読み書きの情報が出力されています。

このセクションではInnoDB、さまざまなタイプのI / Oを実行するために使用するスレッドに関する情報を提供します 。これらの最初のいくつかは、一般的なInnoDB処理専用 です。コンテンツには、保留中のI / O操作の情報とI / Oパフォーマンスの統計も表示されます。

これらのスレッドの数は、innodb_read_io_threadsおよび innodb_write_io_threads パラメーターによって制御され ます。セクション15.14「InnoDBの起動オプションとシステム変数」を参照してください。

dev.mysql.com

INSERT BUFFER AND ADAPTIVE HASH INDEX

-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 3 buffer(s)
25.71 hash searches/s, 49.56 non-hash searches/s

INDEXにまつわる情報が出力されています。

このセクションには、InnoDB挿入バッファー(変更バッファーとも呼ばれます)と適応ハッシュ索引の状況が表示 されます。

関連情報については、 セクション15.5.2「変更バッファ」および セクション15.5.3「アダプティブハッシュインデックス」を参照してください。

hackerslab.aktsk.jp

LOG

---
LOG
---
Log sequence number          29224504
Log buffer assigned up to    29224504
Log buffer completed up to   29224504
Log written up to            29224504
Log flushed up to            29224504
Added dirty pages up to      29224504
Pages flushed up to          29224504
Last checkpoint at           29224504
11 log i/o's done, 0.19 log i/o's/second

ログにまつわる情報が出力されています。

  • このセクションには、InnoDBログに関する情報が表示され ます。内容には、現在のログシーケンス番号、ログがディスクにフラッシュされた距離、InnoDB最後にチェックポイントを取得した位置が含まれ ます。(セクション15.11.3「InnoDBチェックポイント」を参照してください 。)このセクションには、保留中の書き込みと書き込みパフォーマンス統計に関する情報も表示されます。

BUFFER POOL AND MEMORY

----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137035776
Dictionary memory allocated 382389
Buffer pool size   8192
Free buffers       7199
Database pages     989
Old database pages 385
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 847, created 142, written 154
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
Buffer pool hit rate 977 / 1000, young-making rate 0 / 1000 not 0 / 1000
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 989, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]

バッファメモリにまつわる情報が出力されています。

ROW OPERATIONS

--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=1, Main thread ID=140268321892096 , state=sleeping
Number of rows inserted 0, updated 0, deleted 0, read 0
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
Number of system rows inserted 0, updated 315, deleted 0, read 4677
0.00 inserts/s, 6.56 updates/s, 0.00 deletes/s, 97.44 reads/s

メインスレッドの情報が出力されています。

  • このセクションでは、各タイプの行操作の数とパフォーマンス率など、メインスレッドが実行していることを示します。

SHOW ENGINE INNODB STATUSの概要を調べてみました。

次はもっと踏み込んで、実際に障害を起こして各パラメータをみて判断することもしてみたいと思いました。

参考資料

www.percona.com

soudai.hatenablog.com

dev.mysql.com

gihyo.jp