Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 28.7Mb
PDF (A4) - 28.7Mb
Man Pages (TGZ) - 189.1Kb
Man Pages (Zip) - 302.2Kb
Info (Gzip) - 2.8Mb
Info (Zip) - 2.8Mb
Excerpts from this Manual memcached Slabs Statistics

To get the slabs statistics, use the stats slabs command, or the API equivalent.

The slab statistics provide you with information about the slabs that have created and allocated for storing information within the cache. You get information both on each individual slab-class and total statistics for the whole slab.

STAT 1:chunk_size 104
STAT 1:chunks_per_page 10082
STAT 1:total_pages 1
STAT 1:total_chunks 10082
STAT 1:used_chunks 10081
STAT 1:free_chunks 1
STAT 1:free_chunks_end 10079
STAT 9:chunk_size 696
STAT 9:chunks_per_page 1506
STAT 9:total_pages 63
STAT 9:total_chunks 94878
STAT 9:used_chunks 94878
STAT 9:free_chunks 0
STAT 9:free_chunks_end 0
STAT active_slabs 2
STAT total_malloced 67083616

Individual stats for each slab class are prefixed with the slab ID. A unique ID is given to each allocated slab from the smallest size up to the largest. The prefix number indicates the slab class number in relation to the calculated chunk from the specified growth factor. Hence in the example, 1 is the first chunk size and 9 is the 9th chunk allocated size.

The parameters returned for each chunk size and a description of each parameter are provided in the following table.

Statistic Description Version
chunk_size Space allocated to each chunk within this slab class.
chunks_per_page Number of chunks within a single page for this slab class.
total_pages Number of pages allocated to this slab class.
total_chunks Number of chunks allocated to the slab class.
used_chunks Number of chunks allocated to an item..
free_chunks Number of chunks not yet allocated to items.
free_chunks_end Number of free chunks at the end of the last allocated page.
get_hits Number of get hits to this chunk 1.3.x
cmd_set Number of set commands on this chunk 1.3.x
delete_hits Number of delete hits to this chunk 1.3.x
incr_hits Number of increment hits to this chunk 1.3.x
decr_hits Number of decrement hits to this chunk 1.3.x
cas_hits Number of CAS hits to this chunk 1.3.x
cas_badval Number of CAS hits on this chunk where the existing value did not match 1.3.x
mem_requested The true amount of memory of memory requested within this chunk 1.4.1

The following additional statistics cover the information for the entire server, rather than on a chunk by chunk basis:

Statistic Description Version
active_slabs Total number of slab classes allocated.
total_malloced Total amount of memory allocated to slab pages.

The key values in the slab statistics are the chunk_size, and the corresponding total_chunks and used_chunks parameters. These given an indication of the size usage of the chunks within the system. Remember that one key-value pair is placed into a chunk of a suitable size.

From these stats, you can get an idea of your size and chunk allocation and distribution. If you store many items with a number of largely different sizes, consider adjusting the chunk size growth factor to increase in larger steps to prevent chunk and memory wastage. A good indication of a bad growth factor is a high number of different slab classes, but with relatively few chunks actually in use within each slab. Increasing the growth factor creates fewer slab classes and therefore makes better use of the allocated pages.