Varnish as load balancer

Carlos Oliva G. carlos.oliva at
Mon Apr 20 05:39:23 CEST 2009


I've been following the Varnih development for the last few months.  
I'm using it as a front-end cache for a fairly large Website which  
runs on Zope/Plone, with a Zeo Cluster architecture of 1 Zeo Server  
and 3 Zeo Clients sitting behind Lighttpd acting as a load balancer,  
which in turn is right behind Varnish.

I'm currently implementing Varnish over a similar setup, but I began  
working with the 2.0 version of the software. After discovering and  
playing around with all the new options I upgraded the original  
Varnish installation.

In the current setup I'm skipping Lighttpd altogether and began using  
Varnish as a load balancer altogether as well, with the 'directors'  
feature. However I'm still missing the last bit of the requested  
functionality that is to evenly balance all the requests from  
'anonymous' users that aren't registered/logged into the system (which  
I am already identifying in the sub_rcvd function of my VCL), but for  
registered users to preserve their session by redirecting them always  
to the same backend server. I know I can create a 'hash' using some  
relatively unique values, as the originating IP address + the User  
Agent and a session-dependent cookie value, but what I don't know is  
(if possible), how to use this hash to determinate to what backend  
server to direct the request to.

If what I'm asking is not possible to do with Varnish, any suggestions  
on using another tool as a load balancer behind Varnish would be  
greatly appreciated.

Best regards,

 Carlos Oliva G.
Igloo Sistemas Ltda.
carlos.oliva at -

More information about the varnish-misc mailing list