加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

mysql 5.6 参数调优之  innodb_buffer_pool_instances

(2016-11-11 18:05:59)
分类: database
在mysql 5.6中新增了 这个参数  innodb_buffer_pool_instances, 一直不太理解这个参数的意义,知道在国外的一篇 mysql 5.7 的性能测试文档中看到了端倪,  之前 此参数都是默认配置, 即 为1  ,后来看了国外的文档后才 恍然大悟,  

借用官方的文档吧 
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. 
This option takes effect only when you set the innodb_buffer_pool_size to a size of 1 gigabyte or more. The total size you specify is divided among all the buffer pools. For best efficiency, specify a combination of innodb_buffer_pool_instances and innodb_buffer_pool_size so that each buffer pool instance is at least 1 gigabyte. 
Before MySQL 5.6.6, the default is 1. As of MySQL 5.6.6, the default is 8, except on 32-bit Windows systems, where the default depends on the value of innodb_buffer_pool_size: 
If innodb_buffer_pool_size is greater than 1.3GB, the default for innodb_buffer_pool_instances is innodb_buffer_pool_size/128MB, with individual memory allocation requests for each chunk. 1.3GB was chosen as the boundary at which there is significant risk for 32-bit Windows to be unable to allocate the contiguous address space needed for a single buffer pool. 
Otherwise, the default is 1. 
大致意思是 当 innodb_buffer_pool_size 设置的 大于 1GB  以后  那么此参数设置就尤为重要了,    MySQL 5.6.6开始 此参数默认为 8,   主要目的是为了解决 互斥锁,  每个缓冲池管理其自己的空闲列表,提高查询并发性, 对于互斥锁 可以自行补脑吧, 如果innodb_buffer_pool_size大于1.3GB,则innodb_buffer_pool_instances的默认值为innodb_buffer_pool_size / 128MB   即大致为 10 左右.每个实例 具有独立的缓存区块




-----------------------------------------------------------------------------------------------------------------

补充下打开表缓存的实例 
table_open_cache_instances  这个参数也是mysql  5.6 新增的特性  用以减少线程间表锁争用. 建议设置 8-16,在多线程 多核心CPU上尤为有效.

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有