Is memcached a good way to store session share ammong web servers?

Perrin Harkins perrin at
Mon Nov 13 15:12:23 UTC 2006

Peter Bengtson wrote:
> True, 
> if someone were to switch off the box running the sessions memcache 
> store, users would be logged out and would have to log in again. But you 
> can get around that by using several memcache instances.

I don't think that will help.  It's not replicated, so if you run two 
memcached serves and one goes down (or segfaults, or runs out of memory) 
you lose half your data.  Better than losing all of it, but not for the 
people whose sessions just disappeared.

> Also, the same 
> problem applies to any solution: if your session storage disks become 
> full, for instance, or if your load balancer suddenly crashed. There 
> will always be vulnerable spots.

There are tools you can use which provide redundancy and failover for 
stored data.  You can't get that from memcached at this point.

You can also just use memcached as a cache, and keep the permanent 
storage in something more durable.  That works great for read-mostly data.

- Perrin

More information about the memcached mailing list