Bill: Mysql5.6 Cache Hit Ratio

Source: Internet
Author: User
Tags parse error

MySQL Cache hit ratio, the online statement is different, below I say my view, everyone tap:

The total number of select queries equals Com_select (dead) + qcache_hits (hit) + Parse error query.

Let's take a look at the Com_select variable:

Mysql>Show Global Status like 'Com_select'; +---------------+-------+  |Variable_name|Value|  +---------------+-------+  |Com_select|  $    |  +---------------+-------+  

Com_select equals qcache_inserts (cache invalidation) + Qcache_not_cache (no cache) + Permission check error query.

Therefore, the query cache hit rate for MySQL ≈qcache_hits/(qcache_hits + com_select)

Query Cache variables:

Mysql>Show Global Status like 'qcache%'  +-------------------------+----------+  |Variable_name|Value|  +-------------------------+----------+  |Qcache_free_blocks| 1        |  |Qcache_free_memory| 18856920 |  |Qcache_hits| 3        |  |Qcache_inserts|  -       |  |Qcache_lowmem_prunes| 0        |  |Qcache_not_cached|  -       |  |Qcache_queries_in_cache| 0        |  |Qcache_total_blocks| 1        |  +-------------------------+----------+ 

So the query cache hit ratio ≈3/(3+46) = 6.12% in this example

Query cache variable Meaning:

Qcache_free_blocks

The number of memory blocks in the Query cache, which is still idle, is large, indicating that there may be fragmentation. FLUSH QUERY Cache organizes the fragments in the cache to get a free block.

Qcache_free_memory

The total amount of free memory in the cache.

Qcache_hits

The number of cache hits.

Qcache_inserts

The number of cache failures.

Qcache_lowmem_prunes

The number of times that the cache is out of memory and must be cleaned up to provide space for more queries. This number is best seen over a long period of time, and if the number is growing, it can mean that fragmentation is very serious, or that there is little memory. (The Free_blocks and free_memory above can tell you which is the case).

Qcache_not_cached

The number of queries that are not appropriate for caching, usually because these queries are not a SELECT statement and are not cached by the cache because of query_cache_type settings.

Qcache_queries_in_cache

The number of queries (and responses) currently cached.

Qcache_total_blocks

The number of blocks in the cache.

Bill: Mysql5.6 Cache Hit Ratio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.