<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>We have a load balanced application where the proxy does *<b>not</b>*
force any type of sticky session with each backend. The app was running in
production as a single instance (pre load-balanced) and we moved it behind the
proxy to be able to add backends and make it load balanced. I had the app in
test for several weeks as a load-balanced setup using memcached to store
sessions across the 2 backends and I am pretty confident that the auth areas
that relied on session storage were working fine.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>As of last night the app throws errors (in UAT) about every
other request when inside an auth area with the 2 backends enabled. I can’t
get the actual message as this time, but it basically was a “Can’t
use 12345 as a HASHREF…” type of error where ‘12345’ is
the ID of the user I was authenticated as. If I disable one of the backends,
clear my cookies and re-login the entire session works fine. As soon as I
re-enable the other backend I start getting the errors again and it doesn’t
matter which backend I use first, they both work independent of one another. Obviously,
the first backend that stores the session works and the other doesn’t,
but what I don’t know is why. <o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>As I stated above, I’m pretty confident that all the
auth areas of the site were functioning in the load-balanced setup before we
went to PROD. So, I looked at what changed and the only thing that changed
related to session storage was that I added a 2<sup>nd</sup> memcached backend
instance to the config file. I wondered if this might have been part of the
problem, but I have since dropped back to only one memcached instance,
restarted it and the errors still persist.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Here is the relevant config section:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>session:<o:p></o:p></p>
<p class=MsoNormal> flash_to_stash: 1<o:p></o:p></p>
<p class=MsoNormal> expires: 3600<o:p></o:p></p>
<p class=MsoNormal> memcached_new_args:<o:p></o:p></p>
<p class=MsoNormal> data:<o:p></o:p></p>
<p class=MsoNormal> - 10.xxx.xxx.xxx:11211<o:p></o:p></p>
<p class=MsoNormal> namespace:
tangeroutlet_tangerweb_session_uat<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>In an effort to troubleshoot this I have also tried to
implement memcached storage using C::P::Session::Store::Cache and
C::P::Cache::Memcached, but I haven’t gotten this to work yet.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>I’m hoping that answers to the following questions
will guide me to a solution:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>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?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>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.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>3. When using memcached to store sessions, is it OK to have
more than one backend? 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?<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>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.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>At this point I think I’d be willing to take a performance
hit and store sessions in DBIC if it’s going to work better in a distributed
environment.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>TIA for any input.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>v/r<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>-matt pitts<o:p></o:p></p>
</div>
</body>
</html>