Domain-based session affinity/persistency

So, here is another pretty cool feature I've implemented. It might interest you if you use multiple domains with reverse proxies.

I was recently asked to add to Perlbal::Plugin::SessionAffinity the ability to allow consistent session affinity per domain. Hell, it's a paid feature so I took a look at it.

The idea is that if you have a lot of domains and you use Perlbal::Plugin::SessionAffinity in your Perlbal reverse proxy, you might get a fragmented cache because each user will reach a different (yet consistent) backend, regardless of the domain they requested. When someone has more than 300 domains behind the same reverse proxies (and let me tell you, some people actually do), this fragmented cache reduces efficiency.

So, now Perlbal::Plugin::SessionAffinity has a domain mode (which can be triggered by the affinity_use_domain configuration option) which returns a fixed backend for every client based on the requested domain. If the backend no longer exists (such as if, for instance, you removed it live from the pool), it will return a different backend - so you can still play with Perlbal live and it will not hurt the SessionAffinity module.

My client seems to have improved cache performance using this feature so far.

If you're using Perlbal::Plugin::SessionAffinity and find it useful, drop me a line. If you're using this feature, I'd be happy to get any feedback.

Leave a comment

About Sawyer X

user-pic Gots to do the bloggingz