[Catalyst] Distributed session storage problems/questions
Lars Balker Rasmussen
lars at balker.dk
Wed Feb 20 18:35:09 GMT 2008
On Wed, Feb 20, 2008 at 01:08:08PM -0500, Matt Pitts wrote:
> 1. What is the acceptable way to use memcached for session storage? Is
> it using C::P::Session::Store::Memcached or is it
> C::P::Session::Store::Cache in conjunction with C::P::Cache::Memcached?
Well, either, really, they do much the same thing. I wrote CPS::Store::Cache
to avoid the silliness of having two connections to memcached per backend,
using two different Cache:: modules.
So, if you have the cache working, it should be very easy to set up
sessions.
> 2. Is memcached even a "good" way to store sessions? DBIC seems to be a
> popular option, but I figured memcached's considerable speed would make
> it the preferred choice.
How important are sessions to you? If dropping a session once in a bluemoon
is acceptable, memcached is perfectly fine. In fact, the memcached process
is about as stable as the rest of the machine it runs on, which should
hopefully be very stable.
> 3. When using memcached to store sessions, is it OK to have more than
> one backend?
YES! Definitely. Silly not to.
> At first I didn't think anything about adding another
> backend, but then I thought that the 2 memcached instances wouldn't have
> the same set of data which would cause problems with sessions, unless of
> course the session writes get distributed to all the backends. I've
> looked into the source of C::P::Session::Store::Memcached,
> Cache::Memcached::Managed and Cache::Memcached and cannot tell if the
> writes are spread across all backends. Does anyone know the answer to
> this?
As long as you specify the servers in the same order on all memcached-
clients, they will hash the keys the exact same way, and a set() on
server B will cause a get() on server A to just work(tm).
> 4. Is it just crazy to run a load balanced setup without some type of
> sticky session setup on the proxy? If so, any implementations of this
> using Apache 2.x mod_proxy(_balancer) as the frontend would be greatly
> appreciated.
Sticky sessions are annoying.
--
Lars Balker Rasmussen Consult::Perl
More information about the Catalyst
mailing list