MySQL query caching: limited to a maximum cache size of 128 MB? MySQL query caching: limited to a maximum cache size of 128 MB? mysql mysql

MySQL query caching: limited to a maximum cache size of 128 MB?


The warning issued by mysqltuner.py is actually relevant even if your cache has no risk of being swapped.It is well-explained in the following:http://blogs.oracle.com/dlutz/entry/mysql_query_cache_sizing

Basically MySQL spends more time grooming the cache the bigger the cache is and since the cache is very volatile under even moderate write loads (queries gets cleared often), putting it too large will have an adverse effect on your application performance. Tweak the query_cache_size and query_cache_limit for your application, try finding a breaking point where you have most hits per insert, a low number of lowmem_prunes and keep a close eye on your database servers load while doing so too.


Usually "too big cache size" warnings are issued under assumption that you have few physical memory and the cache itself well need to be swapped or will take resources that are required by the OS (like file cache).

If you have enough memory, it's safe to increase query_cache size (I've seen installations with 1GB query cache).

But are you sure you are using the query cache right? Do have lots of verbatim repeating queries? Could you please post the example of a typical query?


You should be easy on increasing your cache, it is not only a "not that much available mem" thing!

Reading for instance the manual you get this quote:

Be cautious about sizing the query cache excessively large, which increases the overhead required to maintain the cache, possibly beyond the benefit of enabling it. Sizes in tens of megabytes are usually beneficial. Sizes in the hundreds of megabytes might not be.

There are various other sources you can check out!

A non-zero prune rate may be an indication that you should increase the size of your query cache. However, keep in mind that the overhead of maintaining the cache is likely to increase with its size, so do this in small increments and monitor the result. If you need to dramatically increase the size of the cache to eliminate prunes, there is a good chance that your workload is not a good match for the query cache.

So don't just put as much as you can in that query cache!

The best thing, would be to gradually increase the query cache and measure performance on your site. It's some sort of default in performance questions, but in cases like this 'testing' is one of the best things you can do.