摘要:1 innodb_buffer_pool_instances可以开启多个内存缓冲池,把需要缓冲的数据hash到不同的缓冲池中,这样可以并行的内存读写。
2
innodb_buffer_pool_instances 参数显著的影响测试结果,特别是非常高的 I/O 负载时。
3 实验环境下, innodb_buffer_pool_instances=8 在很小的 buffer_pool 大小时有很大的不同,而使用大的
buffer_pool 时,innodb_buffer_pool_instances=1 的表现最棒。
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 ofinnodb_buffer_pool_instances
and innodb_buffer_pool_size
so
that each buffer pool instance is at least 1 gigabyte.
- 测试日期: Oct-2012
- 测试目的: 测试 MySQL 5.6.7 的表现
- 硬件换
- 服务器: Dell PowerEdge R710
- CPU: 2x Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
- 内存: 192GB(这个内存太猛了)
- 存储: Very Fast PCIe Flash Card
- 文件系统: ext4
- 软件
- 操作系统: CentOS 6.3
- MySQL 版本: 5.6.7-RC
- 测试规范
- 测试工具: tpcc-mysql
- 测试数据: 2500W (~250GB of data)
- 测试时间: 总共测试 4000 秒,但只取最后的 2000 秒,避免因为冷启动的问题导致测试结果不准确
- 不同的测试参数: 使用几组不同的 innodb_buffer_pool_size:13, 25, 50, 75, 100, 125GB ,innodb_buffer_pool_instances: 1
and 8, and innodb_log_file_size: 2x4GB and 2x8GB.
测试结果:
第一个结果使用的事 2x4GB 的 InnoDB 日志文件:

我们可看出当 innodb_buffer_pool_instances=8 在很小的 buffer_pool 大小时有很大的不同,而使用大的 buffer_pool 时,innodb_buffer_pool_instances=1 的表现最棒。
测试结果在大的 buffer_pool 时是很稳定的,原因是 InnoDB 使用异步 flush 模式,在新的 InnoDB flush 机制下以前的问题已经修复。不过 Dimitry 告诉我需要一个更大的 InnoDB 日志文件来获得更稳定的结果。
下面是 2x4GB vs 2x8GB innodb 日志文件大小的比较:

很显然,使用更大的日志文件,测试结果更稳定!
结论:
innodb_buffer_pool_instances 参数显著的影响测试结果,特别是非常高的 I/O 负载时。
在 MySQL 5.6 ,最终是可以获得非常稳定的吞吐,但自适应的 flush 机制仍需较大的日志文件。
MySQL 配置如下:
04 |
innodb_file_per_table
= true |
05 |
innodb_data_file_path
= ibdata1:100M:autoextend |
06 |
innodb_flush_method
= O_DIRECT |
07 |
innodb_log_buffer_size
= 256M |
09 |
innodb_flush_log_at_trx_commit
= 1 |
10 |
innodb_buffer_pool_size
= 125G |
11 |
innodb_buffer_pool_instances=8 |
13 |
innodb_log_file_size
= 4G |
14 |
innodb_log_files_in_group
= 2 |
16 |
innodb_read_io_threads
= 16 |
17 |
innodb_write_io_threads
= 16 |
18 |
innodb_io_capacity
= 20000 |
19 |
innodb_io_capacity_max
= 40000 |
22 |
#not
innodb options (fixed) |
25 |
max_connections
= 2000 |
26 |
max_prepared_stmt_count=500000 |
27 |
max_connect_errors
= 10 |
28 |
table_open_cache
= 2048 |
29 |
max_allowed_packet
= 16M |
30 |
binlog_cache_size
= 16M |
31 |
max_heap_table_size
= 64M |
34 |
thread_cache_size
= 1000 |
42 |
#***
MyISAM Specific options |
45 |
read_rnd_buffer_size
= 4M |
46 |
bulk_insert_buffer_size
= 8M |
47 |
myisam_sort_buffer_size
= 8M |
48 |
myisam_max_sort_file_size
= 10G |
49 |
myisam_repair_threads
= 1 |
转自:http://www.phpchina.com/archives/view-41968-1.html
- mysql优化之索引篇
对mysql优化是一个综合性的技术,主要包括 a: 表的设计合理化(符合3NF) b: 添加适当索引(index) [四种: 普通索引.主键索引.唯一索引unique.全文索引] c: 分表技术(水平 ...
- Mysql优化之my.cnf参数优化
1.innodb_buffer_pool_size innodb_buffer_pool_size 参数用来设置Innodb 最主要的Buffer(Innodb_Buffer_Pool)的大小,也就是 ...
- mysql优化之explain各参数详解:
explain简介 explain命令可以获取Mysql如何执行select语句的信息,包括在select语句执行过程中表如何连接和连接的顺序.当我们想知道这个表操作是索引查询还是全表扫描时,我们就可 ...
- mysql优化———第二篇:数据库优化调整参数
摘要 参数调优内容: 1. 内存利用方面 2. 日志控制方面 3.文件IO分配,空间占用方面 4. 其它相关参数 一 摘要 通过参数提高MYSQL的性能.核心思想如下: 1 提高my ...
- 数据库MySQL学习笔记高级篇
数据库MySQL学习笔记高级篇 写在前面 学习链接:数据库 MySQL 视频教程全集 1. mysql的架构介绍 mysql简介 概述 高级Mysql 完整的mysql优化需要很深的功底,大公司甚至有 ...
- 贴两个mysql优化的配置文件
MySQL5.7以上my.cnf配置文件配置 低配置服务器配置 [client] #客户端设置 port = 3306 socket = /data/mysql/data/mysql.sock def ...
- Mysql数据库操作系统及配置参数优化
数据库结构优化 表的水平拆分常用的水平拆分方法为:1.对 customer_id进行 hash运算,如果要拆分成5个表 则使用mod(customer_id,5)取出0-4个值2.针对不同的 hash ...
- MySQL性能优化之max_connections配置参数浅析
这篇文章主要介绍了MySQL性能优化之max_connections配置参数浅析,本文着重讲解了3种配置max_connections参数的方法,需要的朋友可以参考下 MySQL的max_connec ...
- mysql 优化配置参数(my.cnf)
max_connections:允许客户端并发连接的最大数量,默认值是151,一般将该参数设置为500-2000max_connect_errors:如果客户端尝试连接的错误数量超过这个参数设置的值, ...
随机推荐
- LCA-倍增法(在线)O(nlogn)-O(logn)
1. DFS预处理出所有节点的深度和父节点 inline void dfs(int u) { int i; ;i=next[i]) { if (!deep[to[i]]) { deep[to[i]] ...
- 括号匹配(C++ Stack)
最近在学习C++,所以使用stack容器来实现括号匹配 /**********************************************************/ stack<Ty ...
- Eclipse 安装 HDFS 插件
Eclipse 安装 hdfs 连接插件 1.插件安装 在$HADOOP_HOME/contrib/eclipse-plugin/文件夹中有个hadoop-eclipse-plugin-0.20.20 ...
- SQL 比较中文字符串
/* declare @str1 varchar(200),@str2 varchar(200) set @str1=N'江西省南昌市其它区高新区火炬大道809号' set @str2=N'江西省南昌 ...
- POJ 1182 食物链 经典并查集+关系向量简单介绍
题目: 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形.A吃B, B吃C,C吃A. 现有N个动物,以1-N编号.每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种. 有 ...
- POJ1308 Is It A Tree?
题目大意:和HDU1272-小希的迷宫题目一样, 如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径 ...
- The Rings Akhaten
在其他的平行宇宙中存在着一个古老的星系--Akhaten,星系中有七个世界,上面生活着Panbabylonian.Lucanian等物种,不过外界也常常把他们统称为Akhet,因为这七个世界环绕着同一 ...
- Setting DPDK+OVS+QEMU on CentOS
Environment Build Step: these packages are needed for building dpdk+ovs: yum install -y make gcc gli ...
- Android实现GIF图片解码与播放
Android实现GIF图片解码与播放 如何在Android中播放GIF图片呢?如果直接按以前的方法,分解图片,可能相对比较麻烦. 今天给大伙介绍一种新的方式,构造自己的Android图片解码帮助类, ...
- android 去掉listview之间的黑线
方法1:listView.setDividerHeight(0);方法2:this.getListView().setDivider(null);方法3:android:divider="@ ...