Memcache - some keys are getting deleted before expiration

30 views Asked by At

So I have a python script to update memcache data from my database.

When I am running that script, all the keys are loading fine as I can check. But after a few hours a huge amount of keys are getting deleted (like 10000 out of 75000 keys).

No idea why it is happening....

I have tried reloading the data several times, but same thing.

Also It is not related to expiration time as I am deleting the old key and setting the new.

Also one important thing, the key:values which are getting deleted have, those values are slightly larger on an average.

1

There are 1 answers

0
kagronick On

Run stats items in Memcached. This will tell you why your items are being dropped. They are probably being evicted instead of expiring due to memory pressure.

Memcached groups items of the same size together in slabs. These can fill up and prevent items from being persisted even if there is available space. Run stats slabs to see how the slabs are being utilized.