摘要: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 配置如下:

01 [mysqld]
02 gdb
03  
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
08  
09 innodb_flush_log_at_trx_commit
= 1
10 innodb_buffer_pool_size
= 125G
11 innodb_buffer_pool_instances=8
12  
13 innodb_log_file_size
= 4G
14 innodb_log_files_in_group
= 2
15 #####plugin
options
16 innodb_read_io_threads
= 16
17 innodb_write_io_threads
= 16
18 innodb_io_capacity
= 20000
19 innodb_io_capacity_max
= 40000
20  
21  
22 #not
innodb options (fixed)
23 port
= 3306
24 back_log
= 50
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
32 sort_buffer_size
= 4M
33 join_buffer_size
= 4M
34 thread_cache_size
= 1000
35 query_cache_size
= 0
36 query_cache_type
= 0
37 ft_min_word_len
= 4
38 thread_stack
= 192K
39 tmp_table_size
= 64M
40  
41 server-id =
10
42 #***
MyISAM Specific options
43 key_buffer_size
= 8M
44 read_buffer_size
= 1M
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
50 myisam_recover
51 user=root
52 skip-grant-tables

转自:http://www.phpchina.com/archives/view-41968-1.html

mysql优化---第7篇:参数 innodb_buffer_pool_instances设置的更多相关文章

  1. mysql优化之索引篇

    对mysql优化是一个综合性的技术,主要包括 a: 表的设计合理化(符合3NF) b: 添加适当索引(index) [四种: 普通索引.主键索引.唯一索引unique.全文索引] c: 分表技术(水平 ...

  2. Mysql优化之my.cnf参数优化

    1.innodb_buffer_pool_size innodb_buffer_pool_size 参数用来设置Innodb 最主要的Buffer(Innodb_Buffer_Pool)的大小,也就是 ...

  3. mysql优化之explain各参数详解:

    explain简介 explain命令可以获取Mysql如何执行select语句的信息,包括在select语句执行过程中表如何连接和连接的顺序.当我们想知道这个表操作是索引查询还是全表扫描时,我们就可 ...

  4. mysql优化———第二篇:数据库优化调整参数

    摘要 参数调优内容: 1. 内存利用方面 2. 日志控制方面 3.文件IO分配,空间占用方面 4. 其它相关参数 一  摘要 通过参数提高MYSQL的性能.核心思想如下:         1 提高my ...

  5. 数据库MySQL学习笔记高级篇

    数据库MySQL学习笔记高级篇 写在前面 学习链接:数据库 MySQL 视频教程全集 1. mysql的架构介绍 mysql简介 概述 高级Mysql 完整的mysql优化需要很深的功底,大公司甚至有 ...

  6. 贴两个mysql优化的配置文件

    MySQL5.7以上my.cnf配置文件配置 低配置服务器配置 [client] #客户端设置 port = 3306 socket = /data/mysql/data/mysql.sock def ...

  7. Mysql数据库操作系统及配置参数优化

    数据库结构优化 表的水平拆分常用的水平拆分方法为:1.对 customer_id进行 hash运算,如果要拆分成5个表 则使用mod(customer_id,5)取出0-4个值2.针对不同的 hash ...

  8. MySQL性能优化之max_connections配置参数浅析

    这篇文章主要介绍了MySQL性能优化之max_connections配置参数浅析,本文着重讲解了3种配置max_connections参数的方法,需要的朋友可以参考下 MySQL的max_connec ...

  9. mysql 优化配置参数(my.cnf)

    max_connections:允许客户端并发连接的最大数量,默认值是151,一般将该参数设置为500-2000max_connect_errors:如果客户端尝试连接的错误数量超过这个参数设置的值, ...

随机推荐

  1. updating the chroot

    Ubuntu may stop working after a Chrome OS update. If that's the case, update all the installed targe ...

  2. hr定位

    css里写 <style> hr{ position:relative; top: 500px; } </style> 重要!!! hr不能绝对定位, 只能相对定位,所以 hr ...

  3. 1*Json对象声明简单,复合,对象数组

    //简单JSON对象 function btn1_click() { var json = { "id": 1001, "name": "张三&quo ...

  4. linux sigaction信号处理

    sigaction函数相比signal函数更为复杂,但更具灵活性,下面具体介绍她的结构和用法: #include <signal.h> int sigaction(int signum, ...

  5. java memcache应用

    import java.io.Serializable; import java.text.DateFormat; import java.util.Date; import java.util.Ma ...

  6. Android OpenGL ES(十)绘制三角形Triangle .

    三角形为OpenGL ES支持的面,同样创建一个DrawTriangle Activity,定义6个顶点使用三种不同模式来绘制三角形: float vertexArray[] = { -0.8f, - ...

  7. VMI

    在虚拟机外部监控虚拟机内部运行状态的方法被称为虚拟机自省(Virtual Machine Introspection,VMI).VMI允许特权域查看非特权域的运行状态,并能获得被监控虚拟机运行状况相关 ...

  8. 128M小内存VPS优化与typecho环境搭建

    在使用Haphost提供的128M内存的VPS建站时,debian7+wordpress+nginx+mysql跑起来相当吃力.然后使用Debian7+typecho+lighttpd+sqlite的 ...

  9. tab奇偶行颜色交替+插件

    (function($){ $.fn.tableUI=function(options){ var defaults={ evenRowclass:"evenRow", oddro ...

  10. dump文件生成与调试(VS2008)

    总结一下dump文件生成和调试的方法: 1:用SetUnhandledExceptionFilter捕获未处理的异常,包含头文件<windows.h>.函数原型为: LPTOP_LEVEL ...