On 8 February 2011 23:05, Ben Dodd <[email protected]> wrote:
> Given this functionality, does anyone know what the VCL is required to 
> implement this dual server Varnish setup scenario?
> http://varnish-cache.org/trac/wiki/VCLExampleHashIgnoreBusy

Something like this should work:


backend appserver { ... }
backend other_varnish { ... }

# Server 1
sub vcl_recv {
    set req.backend = other_varnish;
    if (req.http.X-Via-Varnish || !req.backend.healthy) {
        # Request is coming from the other server.
        # Ignore busy objects to avoid race condition.
        set req.hash_ignore_busy = 1;
        set req.backend = appserver;
    } else {
        set req.http.X-Via-Varnish = "true";
    }
}

# Server 2
sub vcl_recv {
    set req.backend = other_varnish;
    if (req.http.X-Via-Varnish || !req.backend.healthy) {
        # Request is coming from the other server.
        set req.backend = appserver;
    } else {
        set req.http.X-Via-Varnish = "true";
    }
}

Laurence

_______________________________________________
varnish-misc mailing list
[email protected]
http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to