Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On a busy mysql server MySQLTuner 1.2.0 always recommends to add query_cache_size no matter how I increase the value (I tried up to 512MB). On the other hand it warns that :

Increasing the query_cache size over 128M may reduce performance

Here are the last results:

 >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.25-1~dotdeb.0-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in InnoDB tables: 6G (Tables: 195)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 51

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 19h 17m 8s (254M q [1K qps], 5M conn, TX: 139B, RX: 32B)
[--] Reads / Writes: 89% / 11%
[--] Total buffers: 24.2G global + 92.2M per thread (1200 max threads)
[!!] Maximum possible memory usage: 132.2G (139% of installed RAM)
[OK] Slow queries: 0% (2K/254M)
[OK] Highest usage of available connections: 32% (391/1200)
[OK] Key buffer size / total MyISAM indexes: 128.0M/92.0K
[OK] Key buffer hit rate: 100.0% (8B cached / 0 reads)
[OK] Query cache efficiency: 79.9% (181M cached / 226M selects)
[!!] Query cache prunes per day: 1033203
[OK] Sorts requiring temporary tables: 0% (341 temp sorts / 4M sorts)
[OK] Temporary tables created on disk: 14% (760K on disk / 5M total)
[OK] Thread cache hit rate: 99% (676 created / 5M connections)
[OK] Table cache hit rate: 22% (1K open / 8K opened)
[OK] Open file limit used: 0% (49/13K)
[OK] Table locks acquired immediately: 99% (64M immediate / 64M locks)
[OK] InnoDB data size / buffer pool: 6.1G/19.5G

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Reduce your overall MySQL memory footprint for system stability
    Increasing the query_cache size over 128M may reduce performance
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_size (> 192M) [see warning above]

The server has 76GB ram and dual E5-2650. The load is usually below 2. I appreciate your hints to interpret the recommendation and optimize the database configs.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

MySQL Query Cache Sizing is a blog entry that you may find useful.

A high-level summary is that once the query_cache gets above a certain size then MySQL spends more time managing the cache than using the cache. Every write that affects a queries results then invalidates the results in the cache.

If your application is mostly reading the database then a large query cache size would be beneficial. If your application is write-heavy you would benefit from a lower cache or no cache at all.

Note that there are many other blog posts discussing large query_cache sizes but in the end they all say you have to actually test settings in your environment for the best setting.

share|improve this answer
    
I see better now. Thanks for great insight. –  wbad Oct 11 '12 at 0:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.