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

Perrin Harkins perrin at elem.com
Mon Nov 13 16:56:20 UTC 2006


On Mon, 2006-11-13 at 07:52 -0800, Randy Wigginton wrote:
> I mean, if a user is  
> suddenly logged out, is that such a terrible situation?

To me, the answer seems like an obvious "YES!", especially if you are
storing any transient data, like a partially completed multi-page form,
in your sessions.  If you aren't storing transient data, you probably
don't need sessions anyway, and could just use some sort of encrypted
cookies.

> Of course, the "suddenly  
> logged out" situation shouldn't happen except under extremely unusual  
> situations.

Hardware failure, a segfault (or accidental shutdown) of the daemon,
running out of memory, or planned maintenance (there's no way to fail
over the current data to another machine while you add more RAM or fix a
drive).  If you decide those are rare enough at your site, and your
users will not be upset about lost session data in those cases, then you
can put sessions in memcached.

> I looked at  sharedance, but we don't want yet another technology in  
> our ops center

Most people already have an RDBMS, and would use it for their sessions,
with memcached as a write-through cache.

- Perrin



More information about the memcached mailing list