Looking for information on balanced backends

Caleb Anthony caleb.anthony at gmail.com
Tue Dec 4 16:58:30 CET 2007


This should help.

http://varnish.projects.linpro.no/wiki/Backends

Right now there are two load balancing methods: round robin and
weighted round robin.

backend_round_robin rr {
                set backend.set = {
                        { "foo1.bar.com", "http" }
                        { "foo2.bar.com", "http" }
                        { "foo3.bar.com", "http" }
                };
        }

backend_random rrr {
                set backend.set = {
                        { "foo1.bar.com", "http", 0.3 }
                        { "foo2.bar.com", "http", 0.6 }
                        { "foo3.bar.com", "http", 0.1 }
                };
        }

Once you have that in your VCL, just select which backend to use like
you normally would:

sub vcl_recv {
                if {req.http.host ~ "foo"} {
                        req.backend = rr;
                } elseif {req.http.host ~ "bar"} {
                        req.backend = rr;
                } else {
                        req.backend = rrr;
                }
        }


BTW, the regular round robin works pretty good for us.

On 12/4/07, Dave Cheney <dave at cheney.net> wrote:
> Hi,
>
>        We use a pair of varnish servers behind a load balancer provided by
> our hosting center. For various technical reasons the load balancer
> can't be used to balance the servers that varnish sits in front of so
> I would like to use the balanced backend functionality (introduced
> somewhere around changeset 1940). I've been looking in the source for /
> trunk and brances/1.2 but I can't find any documentation for
> constructing a VLC script for balanced backends. Can anyone give any
> sample configuration ?
>
> Cheers
>
> Dave
> _______________________________________________
> varnish-dev mailing list
> varnish-dev at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-dev
>



More information about the varnish-dev mailing list