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

Peter Bengtson peter at
Mon Nov 13 10:51:39 UTC 2006

You are comparing apples to oranges here. There is nothing to prevent  
you from setting up memcache with enough memory to support many  
millions of simultaneous sessions, even using a single memcache  
instance. 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. 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.

In the end, it is a question of speed: memcache has almost no  
overhead. If that is what you need, go with memcache. If the overhead  
is not so important, it might be ok to use a disk-based cached  
solution. In other words, exactly the considerations we are familiar  
with from our classes in computer science.

But memcache can, has been and is used to store sessions very  
successfully on large systems, where disk-based solutions have been  
found to become too slow.

On 13 nov 2006, at 11.38, Marcus Bointon wrote:

> On 13 Nov 2006, at 10:27, Peter Bengtson wrote:
>> I'm sorry, but that's not correct: Memcache will not evict data  
>> but signal an error if the amount of memory you allocate to it is  
>> not enough, when configured to do so using the appropriate command- 
>> line option.
> Fair enough, but it will then mean that users are denied access  
> instead of logged in users being kicked out. Still not good.  
> Personally I use Sharedance for sessions (with no database  
> backing), memcached for caching. Works great for me.
> Marcus
> -- 
> Marcus Bointon
> Synchromedia Limited: Creators of
> marcus at |

More information about the memcached mailing list