Backend load balancing delegation in order to support sticky sessions

Tollef Fog Heen tfheen at varnish-software.com
Tue Sep 28 09:04:42 CEST 2010


]] Bayron Guevara 

| Currently I’ve installed Varnish 2.0.6 and I'm using a cluster of Web
| Servers. In order to find a work around the session clustering issue,
| I thought implement session stickiness as part of the load balancing
| configuration, so all subsequent requests from the same user would go
| to the same webserver and so ensure the session information
| consistency. But as I know, Varnish don’t have integrated support to
| Stickiness, and therefore I have to delegate this function to a Load
| Balancer. Through this infrastructure the client requests would follow
| the below path:

In 2.1, you can use the client director to get that stickiness.  With
2.1.4, you'll also have client.identity which you can use to influence
what the client director uses for choosing the backend.

[...]

| I don’t know how to extract a cookie from a Set-Cookie header, but I
| tried with this  code:
|        obj.http.LB-Cookie = regsub(obj.http.Set-Cookie,
| “.*(ARPT=[^;]+(;[^=]+=[^;]+)*).*”, “\1”);
| Nevertheless, it appears don’t work fine.

The Set-Cookie header doesn't work like all the other headers in
RFC2616, so you need to use inline C to poke at it.  This is doable, but
non-trivial.

| Am I in the right way? Is there a better solution?

I'd recommend going with 2.1 and the client director, at least if you
don't need any other features than reasonably simple load balancing from
your load balancer.

-- 
Tollef Fog Heen
Varnish Software
t: +47 21 54 41 73




More information about the varnish-misc mailing list