允许转载, 转载时请以超链接形式标明文章原始出处和网站信息

key cache hit ratio的误区

本文源于最近mysqlperformance上的一篇blog。
文章主要讨论了一个误区:key cache hit ratio 并不能作为key-buffer-size的调优依据。
内容并不复杂,但是传递的思想值得借鉴:调优过程中各种假设会导致最终结论的错误。

原文链接:Why you should ignore MySQL’s key cache hit ratio
正文:(翻译加个人总结)

错误的传统观念:
通过show global status 得到 Key_reads,Key_read_requests的值。Key_buffer_miss_ratio = Key_reads/Key_read_requests. 从而得到索引缓存的miss比率。一般建议这个比率应该小于1:100,否则说明key_buffer_size设置过小,需要调整。
再看一下mysql官方文档对这两个参数的解释:
Key_read_requests:The number of requests to read a key block from the cache.
Key_reads:The number of physical reads of a key block from disk.
可见这样的算法并没有错误。

但是!Key_buffer_miss_ratio真的能作为调优的依据吗?不能!


1
21
3

其他建议:
那我们应该用什么参数来对key-buffer-size进行调优呢?
Key_cache_miss_rate = Key_reads / Uptime (注意原文中用的是rate不是ratio)
这个参数能从一定程度上反应磁盘io频率,从而作为key-buffer-size调优的依据

路过踩一脚

 

 

 

能使用 these HTML 标签

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">