Hi there,

I´m trying to configure memcached in an optimum way, and read in several sites that we must avoid evictions, but nearly with any memcache size I´m getting that ones.

These are one of my memcached servers stats:

STAT pid 18152
STAT uptime 375658
STAT time 1289721928
STAT version 1.4.2
STAT pointer_size 64
STAT rusage_user 33.560000
STAT rusage_system 193.950000
STAT curr_connections 5
STAT total_connections 282120
STAT connection_structures 91
STAT cmd_get 14195297
STAT cmd_set 1017657
STAT cmd_flush 0
STAT get_hits 7867762
STAT get_misses 6327535
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 13936
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT bytes_read 9784225908
STAT bytes_written 353701760095
STAT limit_maxbytes 1073741824
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 949742464
STAT curr_items 245207
STAT total_items 1017677
STAT evictions 20786

Should I give more memory to memcache, or is it normal to have evictions after some days?

Thanks in advance!

Comments

SimonVlc’s picture

Our last try, 2GB to memcache. Again, filled to it´s maximum. These are the munin graphs:

http://dl.dropbox.com/u/166832/memcache-2gb.png

digi24’s picture

I am dealing with the same problem. My question would be, whether evictions are worse than flushing memcache and have cache items recreated. Or in other words: does an eviction plus subsequent storage create significantly more overhead than a storage operation on an empty cache?

robertDouglass’s picture

evictions are a normal part of memcached. Don't restart memcached becuase you're getting evictions. The way memcached manages memory might be inefficient for Drupal to some extent because it divides the available memory into slabs and partitions each slab by a specific size. If you send memcached something that takes up 50K, it has to put it into a slab that is predetermined to take something that big or bigger. So if you have a lot of big items, you never use the smaller slabs, and if you have a lot of small items, you fill up the bigger slabs with small items. I imagine it's like storing a pair of socks in a moving carton - lots of wasted space.

Now, it could be that there is a flaw in the caching logic in the module that leads to extra cache_set() calls. If you can find something like that, it's a bug and we should fix it.

Furthermore, with the coming 1.8 version, you can assign a bin to 'database' storage and it won't go to memcache at all. You could experiment with putting some of the bigger caches (like cache_page) back into database caching and see if this stops the evictions.

catch’s picture

Status: Active » Closed (fixed)

Closing this out, that's a good explanation.

Another thing to note is that the memcache module doesn't flush items when caches are cleared, it just invalidates them and overwrites - so if your server is running a long time, you will see plenty of evictions - but these will be of items that aren't live at all.

prsnjtbarman’s picture

Version: 6.x-1.7 » 8.x-2.x-dev
Component: Miscellaneous » Code
Issue summary: View changes

Should I enable both default and memcache together ?
I am getting Evictions ... But my available memory shows, 54.2 MB (10.59%) of 512 MB
Please advice