• Cecilie Fritzvold's avatar
    Added support for load balancing among backends in varnish. It is still experimental · 0b0c12a1
    Cecilie Fritzvold authored
    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: http://www.varnish-cache.org/svn/trunk/varnish-cache@1931 d4fa192b-c00b-0410-8231-f00ffab90ce4
    0b0c12a1
Name
Last commit
Last update
bin Loading commit data...
debian Loading commit data...
doc Loading commit data...
etc Loading commit data...
include Loading commit data...
lib Loading commit data...
man Loading commit data...
redhat Loading commit data...
ChangeLog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README Loading commit data...
autogen.des Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
varnishapi.pc.in Loading commit data...