varnish redundancy

Poul-Henning Kamp phk at
Thu Sep 3 13:01:55 CEST 2009

In message <d340a0f10909030341w477afb0fvbe7bb23d12a6537a at>, Rob A
yres writes:

>Does anyone have any experience or tips on using varnish in this way?

You can do some really insteresting things, such as:

One such is to configure the two varnishes along these lines:

	vcl_recv {
		if (client.ip ~ other_varnish) {
			set req.backend = real_backend;
		} else {
			set req.backend = other_varnish;

	vcl_pass {
		set req.backend = real_backend;

	vcl_pipe {
		set req.backend = real_backend;

For it to be really smart you want to use directors for the
"other_varnish" and probes to ascertain health.

We do not have a "priority_director" (we probably should have)
but you can get much the same effect with the random director
and very uneven weights:

	director other_backend {
		{ .backend = b_other_varnish ; weight=100000; }
		{ .backend = b_real_backend ; weight=1; }

Should the probes mark the other_varnish unhealthy, all trafic
will go to the real backend.

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-misc mailing list