Cbstats output with memcache bucket


#1

Hello,
maybe somebody will be so kind to clarify a point for me.

Reading around, I seem to understand that expired items should be removed from a bucket only on two occasions… in the words of a post in the forums:

  • when an expired item is accessed (if your application is doing a get of a key that is expired it will return a not found/null and remove the item from the RAM)
  • when the bucket has no RAM left it will automatically remove some expired items to be able to store new items."

Ok. But then, how do I read the cbstats items snippet below? What does the ‘reclaimed’ figure means? The bucket has plenty of memory left (2.5G free out of 6G total).

items:9:age: 18491993
items:9:evicted: 0
items:9:evicted_nonzero: 0
items:9:evicted_time: 0
items:9:number: 4844507
items:9:outofmemory: 0
items:9:reclaimed: 70041863
items:9:tailrepairs: 0

What I find strange is that the number of items in this bucket oscillates between 5 and 6 M, with a weekly cycle. But if we are not evicting anything (stats zero everywhere) and each deletion due to expiration is followed by a new item being inserted (receive a miss -> fetch the item from a database and re-insert it in cache) , then why is the number of items decreasing? Shouldn’t this be constant or always increasing?

Thanks!


#2

When you store an item into the memcached bucket types it first tries to look at the least recently used objects to see if it is already expired. If that is the case it will grab that object instead of allocating new memory. This will cause the reclaimed counter to increase. If none of the objects in the tail of that list have expired it will try to allocate more memory for the item, but if we’ve already used all of the memory we’re supposed to use it will go back to the tail of the list of the objects and evict one of the objects instead (and that cause the eviction counter to increase).

Hope this helps.


#3

Thanks for your answer, did not find anything documented about this behavior.

I still do not understand why the number of objects is decreasing, though. if we replace only when we insert, then the number of objects should stay constant. Or is the counter only including unexpired items, by any chance?

Thanks again,
Paolo


#4

Hi Paolop,

We are also seeing same issue of diminishing item counts in CB Admin Console for one of Memcached bucket, Do you happen to figure out root cause for this issue?. That would be great in order for me to investigate on my code.


#5

Hi,
No, we did not find any definitive answer to what we were (and are still) seeing. I assume there is some inconsistency in the way in which the statistics are displayed in the console.

We have buckets (web cache containers) showing consistent up/down patterns, when we only insert and read items (never delete them). It does not seem to affect anything, though.

Thanks,
Paolo


#6

Thank you paolop, Let me try to check with only insert & read operations against both memcached buckets. What is wondering us is that we have two memcached buckets, one of them displays correct item counts where as second bucket shows items decreasing after expiry time.