高并发场景下为什么要调整innodb_buffer_pool_instances

2024年 3月 18日 20.2k 0

为什么要调整innodb_buffer_pool_instances

独立管理 flush list,lru,free list;bir,比如对某些大表频繁操作导致LRU全局影响

增强并发能力,降低latch锁争用

在官方文档中有如下解释

The number of regions that the InnoDB buffer pool is divided into. For systems with buffer pools in the multi-gigabyte range, dividing the buffer pool into separate instances can improve concurrency, by reducing contention as different threads read and write to cached pages. Each page that is stored in or read from the buffer pool is assigned to one of the buffer pool instances randomly, using a hashing function. Each buffer pool manages its own free lists, flush lists, LRUs, and all other data structures connected to a buffer pool, and is protected by its own buffer pool mutex.

将缓冲池划分为单独的实例可以通过减少不同线程读取和写入缓存页面时的争用(latches)来提高并发性;包含bufferpool的内部内存结构(是否引用,是否),如buf_block_t buf_page_t

CS-15-445 Database Systems 中有如下解释

The DBMS can maintain multiple buffer pools for different purposes (i.e per-database buffer pool, per-page type
buffer pool). Then, each buffer pool can adopt local policies tailored for the data stored inside of it. This method can
help reduce latch contention and improves locality.
Two approaches to mapping desired pages to a buffer pool are object IDs and hashing.
Object IDs involve extending the record IDs to have an object identifier. Then through the object identifier, a mapping
from objects to specific buffer pools can be maintained.
Another approach is hashing where the DBMS hashes the page id to select which buffer pool to access.

每个缓冲池都可以采用针对其内部存储的数据量身定制的本地策略

减少锁存争用(内部结构 hash table )并提高局部性

某些数据库创建表空间还可以指定独有的bufferpool隔离管理

create tablespace bufferpool buff_name

相关文章

pt-kill工具的使用
pt-ioprofile工具包的使用
数据库管理-第216期 Oracle的高可用-01(20240703)
DBMS_REPAIR EXAMPLE SCRIPT WITH PARTITION
数据库事务的四大特性: ACID 
使用BBED修复损坏的SYSTEM文件头

发布评论