I am seeing evictions when the memcached is only 40% full. How is that possible?
Asked
Active
Viewed 1.3k times
8
-
Hmmm what system are you using memcached on? Does memcached have a direct-mapped memory implementation? I don't see why it would...but who knows. – PinkElephantsOnParade Jun 18 '12 at 19:51
-
We have a cluster of 4 nodes running on Redhat linux. Not sure what you meant by direct-mapped memory implementation. But we are using membase which gives memcached as a package. – apatel Jun 18 '12 at 20:27
-
http://stackoverflow.com/questions/6868256/memcached-eviction-prior-to-key-expiry/10456364#10456364 – John Hinnegan Mar 12 '13 at 21:44
3 Answers
14
Check the slab sizes by running the memcached stats. Looks like your slabs are not evenly populated and that is causing the evictions even when the cache is not full full.

Justin
- 357
- 1
- 5
- 9
-
2This is exactly the case we had. One of the slab in default bucket was full and was causing the evictions. We created a new bucket just for those objects of almost same size and we don't have this issue anymore. Thanks all for your answers. – apatel Oct 26 '12 at 19:00
-
3
I wrote up a long explanation to this question which would apply equally to this as well.

Community
- 1
- 1

John Hinnegan
- 5,864
- 2
- 48
- 64
1
Memcached stores data according to slabs of different memory chunks. If the different memory chunks are already allocated, then the Least recently used algorithm runs on the slab and evicts the data out, even if the there are no data in other memory slabs.
Therefore a large distribution of data sizes can be responsible for this problem. By having multiple instances of memcached running and using it as a distributed system, the issue can be reduced.

dan-boa
- 590
- 4
- 10