It should be possible to detect the number of bytes actually allocated in a
given slab class to make it easier to detect if one is using the wrong
growth factor.
Patch: http://github.com/trondn/memcached/tree/issue_42
The stats slabs output looks like:
set a 1 0 1
a
STORED
stats slabs
STAT 1:chunk_size 80
STAT 1:chunks_per_page 13107
STAT 1:total_pages 1
STAT 1:total_chunks 13107
STAT 1:used_chunks 1
STAT 1:free_chunks 0
STAT 1:free_chunks_end 13106
STAT 1:mem_requested 51
STAT 1:get_hits 0
STAT 1:cmd_set 1
STAT 1:delete_hits 0
STAT 1:incr_hits 0
STAT 1:decr_hits 0
STAT 1:cas_hits 0
STAT 1:cas_badval 0
STAT active_slabs 1
STAT total_malloced 1048560
END
quit
Cheers,
Trond
Also I wonder if we should represent this value a little differently.
So the point of this is to expose wasted space in the slab, right? If we
just represent this as a raw number of bytes, its not immediately clear
that there is an issue ... I have to compare this value against the
chunks size and number of chunks used. Couldnt we instead represent this
as a ratio of bytes used to bytes available (bytes_used/used_chunks *
chunk_size) , thereby making it a bit clearer, at least to me :-), what
the significance of this number is.
For example, in your case, you have one entry that uses 51 bytes of an
80 byte chunk. If we represent this value as a ratio, the stats would
show that this slab config results in wasting ~38% of the available slab
space.
my $.02
Eric
That said ... I don't have any great alternative ideas offhand.
-Dormando
Eric