摘要: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:如果客户端尝试连接的错误数量超过这个参数设置的值, ...
随机推荐
- LeetCode OJ 108. Convert Sorted Array to Binary Search Tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 把一 ...
- 监控 monitor java 代码
/* * To change this license header, choose License Headers in Project Properties. * To change this t ...
- mvc页面中,显示自定义时间格式
1.在model中,遇到datetime格式的字段,用string来表示 model中 /// <summary> /// 开始时间 /// </summary> [Displ ...
- Nginx配置IP白名单和黑名单
白名单设置,访问根目录 location / { allow 123.34.22.155; allow ; deny all; } 黑名单设置,访问根目录 location / { deny 123. ...
- Linux 任务控制(bg job fg nohup &)
一. 简介 Linux/Unix 区别于微软平台最大的优点就是真正的多用户,多任务.因此在任务管理上也有别具特色的管理思想.我们知道,在 Windows 上面,我们要么让一个程序作为服务在后台 ...
- ubuntu 14.04安装postgresql最新版本
官网:https://www.postgresql.org/download/linux/ubuntu/ ----------------------------------------------- ...
- spark中groupByKey与reducByKey
[译]避免使用GroupByKey Scala Spark 技术 by:leotse 原文:Avoid GroupByKey 译文 让我们来看两个wordcount的例子,一个使用了reduceB ...
- arrayList里的快速失败
快速失败是指某个线程在迭代集合类的时候,不允许其他线程修改该集合类的内容,这样迭代器迭代出来的结果就会不准确. 比如用iterator迭代collection的时候,iterator就是另外起的一个线 ...
- 使用libvirt做适配的kvm虚拟机window server 2008 磁盘性能的提升
实验室自己做了一个iaas的项目,当时是为了更方面的在kvm和xen下进行迁移,所以选择了libvirt作为适配层. 昨天简单的测试一了一下我们跟qingcloud的性能对比.我们的linux主机性能 ...
- JavaScript(四)---- 函数
函数主要用来封装具体的功能代码. 函数是由这样的方式进行声明的:关键字 function.函数名.一组参数,以及置于括号中的待执行代码. 格式: function 函数名(形参列表){ ...