mysql innodb_sort_buffer_size_mysql优化---第7篇:参数 innodb_buffer_pool_instances设置
摘要: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 innodb_sort_buffer_size_mysql优化---第7篇:参数 innodb_buffer_pool_instances设置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 红帽(redhat linux) 初级认
- 下一篇: 数据库杂谈(七)——数据库的存储结构