龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 数据库类 > MySQL 技术 >

MySQL数据库优化的方案与实践(1)(3)

时间:2011-04-12 23:18来源:未知 作者:admin 点击:
分享到:
数据库 1.flashcache参数 创建flashcache:flashcache_create -b 4k cachedev /dev/sdc /dev/sdb 指定flashcache的block大小与 Percona 的page大小相同。 Flashcache参数设置: flashcache

数据库

1.flashcache参数

创建flashcache:flashcache_create -b 4k cachedev /dev/sdc /dev/sdb

指定flashcache的block大小与Percona的page大小相同。

Flashcache参数设置:

flashcache.fast_remove = 1:打开fast remove特性,关闭机器时,无需将cache中的脏块写入磁盘。

flashcache.reclaim_policy = 1:脏块刷出策略,0:FIFO,1:LRU。

flashcache.dirty_thresh_pct = 90:flashcache上每个hash set上的脏块阀值。

flashcache.cache_all = 1:cache所有内容,可以用黑名单过滤。

flashecache.write_merge = 1:打开写入合并,提升写磁盘的性能。

2.Percona参数

innodb_page_size:如果使用fusionio,4K的性能最好;使用SAS磁盘,设置为8K。如果全表扫描很多,可以设置为16K。比较小的page size,可以提升cache的命中率。

innodb_adaptive_checkpoint:如果使用fusionio,设置为3,提高刷新频率到0.1秒;使用SAS磁盘,设置为2,采用estimate方式刷新脏页。

innodb_io_capacity:根据IOPS能力设置,使用fuionio可以设置10000以上。

innodb_flush_neighbor_pages = 0:针对fusionio或者SSD,因为随机IO足够好,所以关闭此功能。

innodb_flush_method=ALL_O_DIRECT:公版的MySQL只能将数据库文件读写设置为DirectIO,对于Percona可以将log和数据文件设置为direct方式读写。但是我不确定这个参数对于innodb_flush_log_at_trx_commit的影响。

innodb_read_io_threads = 1:设置预读线程设置为1,因为线性预读的效果并不明显,所以无需设置更大。

innodb_write_io_threads = 16:设置写线程数量为16,提升写的能力。

innodb_fast_checksum = 1:开启Fast checksum特性。

以上就是MySQL数据库优化方案,如想更多的了解MySQL数据库请到:http://database.51cto.com/col/484/


精彩图集

赞助商链接