Reputation: 482
The statistics on my memcached server show a strange relationship: total_items is less than cmd_set. The only operations run on this server are "set" and "get", nothing else like "add", "replace", "delete" or CAS based operations.
When I go through the memcached source code, I see that any "normal" set (w/o CAS) will either replace or write the item, and both will increment total_items.
do_store_item() {
// ...
if (old_it != NULL)
item_replace(old_it, it, hv);
else
do_item_link(it, hv);
// ...
}
do_item_link() increases total_items, and item_replace() also calls do_item_link(). Then how can total_items be less than cmd_set?
Excerpt from memcached stats (numbers indented for readability):
STAT cmd_set 12827359728
STAT total_items 4237422053
STAT curr_items 60745375
STAT expired_unfetched 9898430934
STAT evicted_unfetched 30415090
STAT evictions 30421532
STAT reclaimed 9900995350
Upvotes: 0
Views: 210
Reputation: 482
The statistics looked so strange because they are wrong. It is a memcached bug (integer overrun at 2^32). memcached developers have acknowledged and fixed it. For more details see https://github.com/memcached/memcached/issues/161.
Upvotes: 1