]> err.no Git - varnish/commit
Added support for load balancing among backends in varnish. It is still experimental
authorcecilihf <cecilihf@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 31 Aug 2007 12:14:06 +0000 (12:14 +0000)
committercecilihf <cecilihf@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 31 Aug 2007 12:14:06 +0000 (12:14 +0000)
commitfa0f40915d5115e6092a1bb7d3a8f649398d43eb
treefe7dce9998eaa708de76ff81840a227fd00012d5
parent2d8a808674a49c094eddd9187ecbb81f282ec5bd
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
14 files changed:
varnish-cache/bin/varnishd/Makefile.am
varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_backend_random.c [new file with mode: 0644]
varnish-cache/bin/varnishd/cache_backend_round_robin.c [new file with mode: 0644]
varnish-cache/include/vrt.h
varnish-cache/include/vrt_obj.h
varnish-cache/lib/libvcl/vcc_backend.c
varnish-cache/lib/libvcl/vcc_compile.h
varnish-cache/lib/libvcl/vcc_fixed_token.c
varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl
varnish-cache/lib/libvcl/vcc_gen_obj.tcl
varnish-cache/lib/libvcl/vcc_obj.c
varnish-cache/lib/libvcl/vcc_parse.c
varnish-cache/lib/libvcl/vcc_token_defs.h