Added support for load balancing among backends in varnish. It is still experimental
and very basic, but it should be ready for testing. Two strategies for load balancing
are implemented: a simple round robin, and a simple weighted random. The following
is an example configuration in vcl. The weight parameter for random is optional. Default
is equal weight.
backend foo {
set backend.host = "foo.bar.com";
set backend.port = "http";
}
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 }
};
}
sub vcl_recv {
if {req.http.host ~ "foo"} {
req.backend = foo;
} elseif {req.http.host ~ "bar"} {
req.backend = rr;
} else {
req.backend = rrr;
}
}
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1931
d4fa192b-c00b-0410-8231-
f00ffab90ce4