摘要: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. 克隆虚拟机系统整个文件快照,然后另起建立该系统,产生的IP地址冲突解决办法

    进入克隆后的文件系统 cd /etc/sysconfig/network-scripts/ cp ifcfg-eth0  ifcfg-eth1 vim ifcfg-eth1   #修改其中的文件内容 ...

  2. 解决网站出现GET .woff 404 (Not Found)的问题

    网站发布到IIS后,发现网站使用的Bootstrap框架所引用的woff字体无法正常显示. 于是跟踪http请求,对woff字体请求出现GET .woff 404 (Not Found)的问题,但是项 ...

  3. PHP的几个常用加密函数【转载】

    转自 https://jellybool.com/post/php-encrypt-functions 在网站的开发过程中,常常需要对部分数据(如用户密码)进行加密,本文主要介绍PHP的几个常见的加密 ...

  4. Boost的VS开发环境搭建

    1. 下载并解压Boost C++ Libs 下载地址: SourceForge:http://sourceforge.net/projects/boost/files/boost/1.48.0/ B ...

  5. 笨方法学python--安装和准备

    1 下载并安装python http://python.org/download 下载python2.7. python2.7并不是python3.5的旧版本. python2现在应用较广,网上资料较 ...

  6. Hibernate 系列教程9-自关联

    自关联:本质还是原来双向一对多,原来要配置两个类,现在全部都配置在一个类里面 Employee public class Employee { private Long id; private Str ...

  7. iOS 枚举写法

    1.第一种 typedef enum { kPRStateNormal = 0, kPRStatePulling = 1, kPRStateLoading = 2, kPRStateHitTheEnd ...

  8. 设置控件全局显示样式 appearance

    iOS5及其以后提供了一个比较强大的工具UIAppearance,我们通过UIAppearance设置一些UI的全局效果,这样就可以很方便的实现UI的自定义效果又能最简单的实现统一界面风格,它提供如下 ...

  9. IPSEC VPN配置实例

    TL-R400VPN应用——IPSEC VPN配置实例 TL-ER6120是TP-LINK专为企业应用而开发的VPN路由器,具备强大的数据处理能力,并且支持丰富的软件功能,包括VPN.IP/MAC 地 ...

  10. java复用类

    java复用类英文名叫reusing classes  ,重新使用的类,复用的意思就是重复使用的类,其实现方法就是我们平常使用的组合和继承: 1.组合: has-a 的关系  (自我理解:组合就是我们 ...