What to do about memcached cache reset

Re: What to do about memcached cache reset

by Matt Spurrier -
Number of replies: 0

As memcached runs out of memory, it cycles the old entries out, rotating old memory.

The problem with this is if you have Moodle cache, and sessions all in one memcached, the cache can take up significantly more capacity than sessions, and sessions tend to be older, so they're first to be pushed out, thus logging people out (or if the cache is too small, never allowing them access, and never performing proper Moodle cache).

At HQ we run 2 memcached's for this very reason, so both sessions and cache have dedicated pools, so neither one is going to push out the other.
We also assign ~ 512M to sessions, and 4GB to cache.

Also restarting the daemons dumps the cache (as they're memory resident only).

On a side note, if you're running memcached-repcached ( replicated memcached ) you will still have to do the same, however you are unable to run the daemon's on incremental ports as repcached requires 2 ports, one for standard comms, one for server-to-server replication, so you'd set it up as memcached1 = 11211,11212, memcached2 = 11213,11214.

You can check your memory usage and culling by telnet'ing to the memcached port and issuing the 'stats' command.
Alternatively you can use a memcached web interface tool to pull this information and view it in a pretty and human readable format.

Matt

Average of ratings: Useful (1)