Understanding delete and memcached stats

dormando dormando at rydia.net
Wed May 14 20:29:36 UTC 2008

> Now comes my actual questions :P
> When I view the stats and extended stats for the server I am confused
> about the item counts. There is curr_items and total_items. I am not
> sure what the difference between the two is. When i run a delete these
> numbers don't go down by much (curr_items may drop by 5-10). I have
> given the memcache server 3.5GB to work with and we haven't reached the
> limit. Do these numbers get reset when deletes happen or will they grow
> until the server is full and it will even out? Also I have read that
> flush doesn't reset the count or remove the memory, but does delete?
> I am sure I will have many, many more questions but for now these are
> the critical ones. Thank you for the help and the time.
> Devon N.

'total_items' are the total number of items created since the instance
started. This number should only go up

'curr_items' is the current number of allocated items.

Just about everything with memcached is evaluated lazily, including
deletes. This is usually really good, for reasons I won't go into right now.

That means on a delete, the item doesn't usually go away until you then
do a 'get' against it. So if you issue all of your deletes, then issue
get's against all of them, you should see the curr_items number drop

Flush works the same way. It simply says "if any get's come on items
created before this point in time, expire them and don't say they exist"
- this means you can "flush" a cache of 30 million items in an instant,
but the stats appear out of sync.

The LRU will consider deleted/expired items for removal before it
ditches anything useful, so it'll pull from them lazily as well.


More information about the memcached mailing list