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 END
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.
|Space allocated to each chunk within this slab class.|
|Number of chunks within a single page for this slab class.|
|Number of pages allocated to this slab class.|
|Number of chunks allocated to the slab class.|
|Number of chunks allocated to an item..|
|Number of chunks not yet allocated to items.|
|Number of free chunks at the end of the last allocated page.|
|Number of get hits to this chunk||1.3.x|
|Number of set commands on this chunk||1.3.x|
|Number of delete hits to this chunk||1.3.x|
|Number of increment hits to this chunk||1.3.x|
|Number of decrement hits to this chunk||1.3.x|
|Number of CAS hits to this chunk||1.3.x|
|Number of CAS hits on this chunk where the existing value did not match||1.3.x|
|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:
|Total number of slab classes allocated.|
|Total amount of memory allocated to slab pages.|
The key values in the slab statistics are the
chunk_size, and the corresponding
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
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.