Resizing the InnoDB Buffer Pool Online

MySQL5.7.5DMRからオンラインで、InnoDB Buffer Poolのサイズを変更出来るようになっています。他の商用データベースでも同じ機能があり、運用において数回程度実行した事がありますが、
正直利用する頻度はそれ程多く無いかと思いますが, “Nice to Have”と言った機能になるでしょうか。いざという時に、インスタンスを再起動せずに変更出来れば色々と凌げる場面もあるかと思います。

―――― 留意点 ―――― 抜粋:8.9.1.1 Resizing the InnoDB Buffer Pool Online
When initiating a resizing operation, the operation does not start until all active transactions are completed. Once the resizing operation is in progress,
new transactions and operations that require access to the buffer pool must wait until the resizing operation finishes.
The exception to this rule is that concurrent access to the buffer pool is permitted while the buffer pool is defragmented and pages are withdrawn during an operation to
decrease buffer pool size. A drawback of allowing concurrent access is that it could result in a temporary shortage of available pages while pages are being withdrawn.
――――――――――――――――――――――――――

以下の2つの値をベースに適宜設定変更して頂ければと思います。
innodb_buffer_pool_chunk_size
innodb_buffer_pool_size

設定変更(其の1)
innodb_buffer_pool_sizeとinnodb_buffer_pool_chunk_sizeが共にDefaultの128Mの状態で、
innodb_buffer_pool_chunk_sizeを指定して小さい値を指定して変更しようとした場合。
エラーにはなりませんが、Bufferの値は変わりません。

root@localhost [performance_schema]> show variables like 'innodb_buffer%';
+-------------------------------------+----------------+
| Variable_name                       | Value          |
+-------------------------------------+----------------+
| innodb_buffer_pool_chunk_size       | 134217728      |
| innodb_buffer_pool_dump_at_shutdown | ON             |
| innodb_buffer_pool_dump_now         | OFF            |
| innodb_buffer_pool_dump_pct         | 25             |
| innodb_buffer_pool_filename         | ib_buffer_pool |
| innodb_buffer_pool_instances        | 1              |
| innodb_buffer_pool_load_abort       | OFF            |
| innodb_buffer_pool_load_at_startup  | ON             |
| innodb_buffer_pool_load_now         | OFF            |
| innodb_buffer_pool_size             | 134217728      |
+-------------------------------------+----------------+
10 rows in set (0.00 sec)

root@localhost [performance_schema]> SET GLOBAL innodb_buffer_pool_size=67108864;
Query OK, 0 rows affected (0.00 sec)

root@localhost [performance_schema]> show variables like 'innodb_buffer%';
+-------------------------------------+----------------+
| Variable_name                       | Value          |
+-------------------------------------+----------------+
| innodb_buffer_pool_chunk_size       | 134217728      |
| innodb_buffer_pool_dump_at_shutdown | ON             |
| innodb_buffer_pool_dump_now         | OFF            |
| innodb_buffer_pool_dump_pct         | 25             |
| innodb_buffer_pool_filename         | ib_buffer_pool |
| innodb_buffer_pool_instances        | 1              |
| innodb_buffer_pool_load_abort       | OFF            |
| innodb_buffer_pool_load_at_startup  | ON             |
| innodb_buffer_pool_load_now         | OFF            |
| innodb_buffer_pool_size             | 134217728      |
+-------------------------------------+----------------+
10 rows in set (0.01 sec)

chunk_small

設定変更(其の2)
既存のinnodb_buffer_pool_sizeサイズ(128M)にinnodb_buffer_pool_chunk_size(128M)を
オンラインで追加した場合は、問題無くInnoDB Buffer Poolが追加され256Mに変更されました。
また、その値からinnodb_buffer_pool_chunk_sizeの値である128Mを再度減らしてみると、
問題無く変更される事も確認出来ます。
innodb_buffer_pool_chunk_sizeは、Defaultで128MですがOptionFileで設定変更を変えるか、
起動時にコマンドで指定してあげる事によってより細かい設定に変更する事も可能です。


root@localhost [performance_schema]> show variables like 'innodb_buffer%';
+-------------------------------------+----------------+
| Variable_name                       | Value          |
+-------------------------------------+----------------+
| innodb_buffer_pool_chunk_size       | 134217728      |
| innodb_buffer_pool_dump_at_shutdown | ON             |
| innodb_buffer_pool_dump_now         | OFF            |
| innodb_buffer_pool_dump_pct         | 25             |
| innodb_buffer_pool_filename         | ib_buffer_pool |
| innodb_buffer_pool_instances        | 1              |
| innodb_buffer_pool_load_abort       | OFF            |
| innodb_buffer_pool_load_at_startup  | ON             |
| innodb_buffer_pool_load_now         | OFF            |
| innodb_buffer_pool_size             | 134217728      |
+-------------------------------------+----------------+
10 rows in set (0.01 sec)

root@localhost [performance_schema]> SET GLOBAL innodb_buffer_pool_size=268435456;
Query OK, 0 rows affected (0.00 sec)

root@localhost [performance_schema]> show variables like 'innodb_buffer%';
+-------------------------------------+----------------+
| Variable_name                       | Value          |
+-------------------------------------+----------------+
| innodb_buffer_pool_chunk_size       | 134217728      |
| innodb_buffer_pool_dump_at_shutdown | ON             |
| innodb_buffer_pool_dump_now         | OFF            |
| innodb_buffer_pool_dump_pct         | 25             |
| innodb_buffer_pool_filename         | ib_buffer_pool |
| innodb_buffer_pool_instances        | 1              |
| innodb_buffer_pool_load_abort       | OFF            |
| innodb_buffer_pool_load_at_startup  | ON             |
| innodb_buffer_pool_load_now         | OFF            |
| innodb_buffer_pool_size             | 268435456      |
+-------------------------------------+----------------+
10 rows in set (0.00 sec)

root@localhost [performance_schema]> SET GLOBAL innodb_buffer_pool_size=134217728;
Query OK, 0 rows affected (0.01 sec)

root@localhost [performance_schema]> show variables like 'innodb_buffer%';
+-------------------------------------+----------------+
| Variable_name                       | Value          |
+-------------------------------------+----------------+
| innodb_buffer_pool_chunk_size       | 134217728      |
| innodb_buffer_pool_dump_at_shutdown | ON             |
| innodb_buffer_pool_dump_now         | OFF            |
| innodb_buffer_pool_dump_pct         | 25             |
| innodb_buffer_pool_filename         | ib_buffer_pool |
| innodb_buffer_pool_instances        | 1              |
| innodb_buffer_pool_load_abort       | OFF            |
| innodb_buffer_pool_load_at_startup  | ON             |
| innodb_buffer_pool_load_now         | OFF            |
| innodb_buffer_pool_size             | 134217728      |
+-------------------------------------+----------------+
10 rows in set (0.00 sec)

root@localhost [performance_schema]> 

chunk_big

Comments are closed.

Post Navigation