innodb存储引擎缓冲池设置为21GB
mysql> show variables like 'innodb_buffer_pool_size'\G;
*************************** 1. row ***************************
Variable_name: innodb_buffer_pool_size
Value: 21474836480
1 row in set (0.00 sec)
innodb存储引擎的内存结构情况
可以设置多个缓冲池实例。每个页根据hash值分配到不同的缓冲池实例中,减少资源竞争,增加并发处理能力
mysql> show variables like 'innodb_buffer_pool_instances'\G;
*************************** 1. row ***************************
Variable_name: innodb_buffer_pool_instances
Value: 4
1 row in set (0.00 sec)
在配置文件中将innodb_buffer_pool_instances设置大于1即可。查看innodb status
。。。。。。
---BUFFER POOL 0
Buffer pool size 327680
Free buffers 327562
Database pages 118
Old database pages 0
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 118, created 0, written 0
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 118, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size 327679
Free buffers 327658
Database pages 21
Old database pages 0
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 21, created 0, written 0
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 21, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
。。。。。。
5.6中可以通过运行如下命令查看各个缓冲池使用状态
mysql> select pool_id,pool_size,
-> free_buffers,database_pages
-> from information_schema.innodb_buffer_pool_stats\G;
*************************** 1. row ***************************
pool_id: 0
pool_size: 327680
free_buffers: 327562
database_pages: 118
*************************** 2. row ***************************
pool_id: 1
pool_size: 327679
free_buffers: 327658
database_pages: 21
*************************** 3. row ***************************
pool_id: 2
pool_size: 327679
free_buffers: 327675
database_pages: 4
*************************** 4. row ***************************
pool_id: 3
pool_size: 327679
free_buffers: 327596
database_pages: 83
4 rows in set (0.00 sec)
时间: 2024-10-11 12:29:22