• 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
..
compat Loading commit data...
Makefile.am Loading commit data...
binary_heap.h Loading commit data...
cli.h Loading commit data...
cli_common.h Loading commit data...
cli_priv.h Loading commit data...
flopen.h Loading commit data...
http_headers.h Loading commit data...
libvarnish.h Loading commit data...
libvcl.h Loading commit data...
miniobj.h Loading commit data...
queue.h Loading commit data...
shmlog.h Loading commit data...
shmlog_tags.h Loading commit data...
stat_field.h Loading commit data...
stats.h Loading commit data...
varnishapi.h Loading commit data...
vcl.h Loading commit data...
vcl_returns.h Loading commit data...
vpf.h Loading commit data...
vrt.h Loading commit data...
vrt_obj.h Loading commit data...
vsb.h Loading commit data...
vss.h Loading commit data...