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

Randy Wigginton krw at nobugz.com
Mon Nov 13 15:52:10 UTC 2006


We use it for session data with happy results.  I mean, if a user is  
suddenly logged out, is that such a terrible situation?  If you are  
in the middle of a wire transfer, maybe, but in 90% of sites on the  
web it doesn't make a big difference.  Of course, the "suddenly  
logged out" situation shouldn't happen except under extremely unusual  
situations.

I looked at  sharedance, but we don't want yet another technology in  
our ops center, especially when memcache does it so nicely.  The only  
thing we wish we had was the ability to find out how much memory is  
available, if all the expired objects were to be kicked out.  Maybe  
next version can have a "flush_expired" command?  In that case, we  
would be able to easily monitor the memcache usage and determine if  
we need to add another instance/more ram.

On Nov 13, 2006, at 7:12 AM, Perrin Harkins wrote:

> 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