Unexpected(?) high 'wasted' memory in memcached

Posted by Nanne on Server Fault See other posts from Server Fault or by Nanne
Published on 2012-06-11T10:16:37Z Indexed on 2012/06/11 10:41 UTC
Read the original article Hit count: 262

Filed under:

Looking at our memcached stats I think I have found an issue I was not aware of before. It seems that we have a strangely high amount of wasted space. I checked with phpmemcacheadmin for a change, and found this image staring at me:

memcached cache size graphic

Now I was under the impression that the worst-case scenario would be that there is 50% waste, although I am the first to admit not knowing all the details. I have read - amongst others- this page which is indeed somewhat old, but so is our version of memcached. I think I do understand how the system works (e.g.) I believe, but I have a hard time understanding how we could get to 76% wasted space.

The eviction rate that phpmemcacheadmin shows is 2 ev/s, so there is some problem here.

  • The primary question is: what can I do to fix this. I could throw more memory at it (there is some extra available I think), maybe I should fiddle with the slab config (is that even possible with this version?), maybe there are other options? Upgrading the memcached version is not a quickly available option.

  • The secondairy question, out of curiosity, is of course if the rate of 75% (and rising) wasted space is expected, and if so, why.

System: This is currently not something I can do anything about, I know the memcached version isn't the newest, but these are the cards I've been dealt.

  • Memcached 1.4.5
  • Apache 2.2.17
  • PHP 5.3.5

© Server Fault or respective owner

Related posts about memcached