Home » Performance » MySQL » Key cache performance contradiction
Key cache performance contradiction [message #5405] Thu, 25 February 2010 18:56 Go to next message
counterpoint  is currently offline counterpoint
Messages: 4
Registered: February 2010
Junior Member
I'm puzzled by the behavior of my key cache. The cache read ratio is currently 6.55% which is said to be high, and there are 2.7 million reads out of 46 million read requests. This is over about 6.4 million MySQL requests (last 5 days).

But at the same time there are 32K unused blocks against only 22K used blocks.

The comment against the 2.7 million reads (in red) is "If Key_reads is big, then your key_buffer_size value is probably too small".

With more free space than used, how would increasing the key buffer size any further help? And with so much free space, why is the performance of the key cache so poor?

Any suggestions?
Re: Key cache performance contradiction [message #5408 is a reply to message #5405 ] Sat, 27 February 2010 22:31 Go to previous messageGo to next message
xaprb  is currently offline xaprb
Messages: 280
Registered: April 2008
Location: Charlottesville, Virginia...
Senior Member
First, I am guessing that you're getting this advice from tuning_primer.sh. Every tuning script has its problems. If the advice doesn't make sense, it is not surprising.

You should not focus on the ratio. The problem with ratios is that they obscure magnitude, and magnitude is what you care about. Specifically, the magnitude of misses. But even still, these misses are just numbers -- they don't have any timing information associated with them, so it's doubly meaningless. Who cares how many misses there are, unless a) you know how much time it's taking or b) you know there are more misses than your server can healthily handle?

So here's my advice:

1) Completely ignore the ratio, and ignore all the advice you see on the web about the ratio. The ratio is a surrogate measure[1] that is useless and distracting. Yes, I know 99% of people are going to disagree with me. They are wrong.

2) If your key buffer has free space after the server is fully warmed up, it's big enough. And because it's not allocated to its full size, any "free space" is actually not wasted at all -- the memory isn't reserved, it's still available for anything else to use if needed.

[1] See http://method-r.com/downloads/doc_details/44-thinking-clearl y-about-performance


Baron Schwartz, Chief Performance Architect
Percona Inc: http://www.percona.com/
Consulting, Training, Services and Support for MySQL & LAMP
+1 (888) 401-3401
Re: Key cache performance contradiction [message #5411 is a reply to message #5408 ] Sun, 28 February 2010 12:36 Go to previous message
xaprb  is currently offline xaprb
Messages: 280
Registered: April 2008
Location: Charlottesville, Virginia...
Senior Member
For a fuller explanation, and a long rant, please see http://www.mysqlperformanceblog.com/2010/02/28/why-you-shoul d-ignore-mysqls-key-cache-hit-ratio/


Baron Schwartz, Chief Performance Architect
Percona Inc: http://www.percona.com/
Consulting, Training, Services and Support for MySQL & LAMP
+1 (888) 401-3401
Previous Topic:Maintaining Central DB Data Sequence
Next Topic:Best way to utilize SSD
Goto Forum:
  


Current Time: Thu Sep 2 20:24:49 EDT 2010

Total time taken to generate the page: 0.01527 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.