[] Buffer pool parameters innodb_buffer_pool_size turn -Mysql

Transfer: https://blog.csdn.net/kk185800961/article/details/79378313/

Consider the following as the main engine Innodb

【 innodb_buffer_pool_size 】

  Memory cache size for the index and data, this is of course possible, read and write data in memory very quickly, reducing disk reads. When the data is submitted after the checkpoint or to meet conditions of a one-time refresh memory data to disk. However, there are operating system or database memory used by other processes, usually set buffer pool size is 3/4 to 4/5 of the total memory. If set up properly, the memory usage may be wasted or excessive use. For a busy server, buffer pool will be divided into multiple instances to improve system concurrency between threads read and write cache to reduce contention. First, the size of the buffer pool by innodb_buffer_pool_instances influence, of course, was less affected.
[Innodb_buffer_pool_instances]

  number of buffer pool is divided into a plurality of cache instance, a fixed value is not dynamically changed. When you load more data into memory, use multiple cache instances to reduce cache contention. When innodb_buffer_pool_size greater than 1GB, innodb_buffer_pool_instances default is 8. If more buffer pool, the average instances of at least 1GB.

  Little impact on innodb_buffer_pool_size as follows:

shell> mysqld --innodb_buffer_pool_size=8G --innodb_buffer_pool_instances=16
mysql> SELECT @@innodb_buffer_pool_size/1024/1024/1024;
+------------------------------------------+
| @@innodb_buffer_pool_size/1024/1024/1024 |
+------------------------------------------+
|                           8.000000000000 |
+------------------------------------------+

shell> mysqld --innodb_buffer_pool_size=9G --innodb_buffer_pool_instances=16
mysql> SELECT @@innodb_buffer_pool_size/1024/1024/1024;
+------------------------------------------+
| @@innodb_buffer_pool_size/1024/1024/1024 |
+------------------------------------------+
|                          10.000000000000 |
+------------------------------------------+
————————————————

[Innodb_buffer_pool_chunk_size]
innodb_buffer_pool_chunk_size default 128MB (changes need to restart), an increase in units of 1MB. 
innodb_buffer_pool_chunk_size maximum estimated as follows:
MAX (innodb_buffer_pool_chunk_size) = innodb_buffer_pool_size / innodb_buffer_pool_instances

 

Based on the above three parameters:

buffer pool estimation formula: (N is a positive integer; total memory buffer pool should be 3/4 to of 4/5)
innodb_buffer_pool_size = N * (* innodb_buffer_pool_chunk_size innodb_buffer_pool_instances)

When N = 1, of the three parameters just to satisfy the following formula:
innodb_buffer_pool_size = innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances

If at this time and then set innodb_buffer_pool_chunk_size less 1MB, then the buffer pool size almost doubled since chunk_size * instances <buffer_pool_size, at this time there are N = 2, buffer_pool_size is (chunk_size * instances) multiple of the size of the

innodb_buffer_pool_size = 2 * (innodb_buffer_pool_chunk_size * innodb_buffer_pool_instances)

Therefore Jiaoyou provided #: Suppose the system memory = 128 GB, buffer pool size expected 100GB (128GB * 80%)
innodb_buffer_pool_instances = # Default. 8, the amount of logic or the CPU
innodb_buffer_pool_chunk_size = 128MB # Default
innodb_buffer_pool_size = 100 GB # N * 8 * 128MG = N GB, N is a positive integer exactly. N = 100 is provided so that the total memory buffer pool is 3/4 to 4/5.

 

【 innodb_page_size 】

innodb_page_size default 16KB, the data memory pages, the operating system should be consistent with the block size (the same innodb_log_write_ahead_size). Probably better for smaller page SSD. When innodb_page_size as 32k and 64k, the maximum line length is 16000 bytes, and does not support ROW_FORMAT = COMPRESSED.

The number of pages contained in a innodb_buffer_pool_chunk_size depends innodb_page_size.

Default: the number of pages that can be stored chunk = innodb_buffer_pool_chunk_size / innodb_page_size = 128 * 1024/16 = 8192

mysql> SELECT @@innodb_buffer_pool_size;
mysql> SELECT @@innodb_buffer_pool_instances;
mysql> SELECT @@innodb_buffer_pool_chunk_size;

 

View:

Guess you like

Origin www.cnblogs.com/july-sunny/p/12624145.html