Varnish 503ing on ~1/100 POSTs

Caunter, Stefan scaunter at topscms.com
Wed Mar 9 16:11:05 CET 2011


I don't think pass or pipe is the issue. 503 means the backend can't
answer, and calling pipe won't change that.

Here's an example.

Set up a "patient" back end; you can collect your back ends into a
patient director.

backend waitalongtime {
        .host = "a.b.c.d";
        .port = "80";
        .first_byte_timeout = 60s;
        .between_bytes_timeout = 10s;
         .probe = {
                .url = "/areyouthere/";
                .timeout = 10s;
                .interval = 15s;
                .window = 5;
                .threshold = 1;
        }
}

Check the number of restarts before you select a back end. Try your
normal, fast director first.

if (req.restarts == 0) {
                        set req.backend = fast;
                } else if (req.restarts == 1) {
                        set req.backend = waitalongtime;
                } else if (req.restarts == 2) {
                        set req.backend = waitalongtime;
                } else {
                        set req.backend = waitalongtime;
                }

If you get a 503, catch it in error, and increment restart. This will
select the slow back end.

sub vcl_error {
        if (obj.status == 503 && req.restarts < 4) {
                restart;
        }
}


Stefan Caunter 
Operations
Torstar Digital
m: (416) 561-4871



-----Original Message-----
From: varnish-misc-bounces at varnish-cache.org
[mailto:varnish-misc-bounces at varnish-cache.org] On Behalf Of Ronan
Mullally
Sent: March-08-11 5:32 PM
To: Stewart Robinson
Cc: varnish-misc at varnish-cache.org
Subject: Re: Varnish 503ing on ~1/100 POSTs

On Tue, 8 Mar 2011, Stewart Robinson wrote:

> Whilst this may not be a fix to a possible bug in varnish have you
tried
> switching posts to pipe instead of pass?

This might well help, but I'd have no way of knowing for sure.  The
backend servers indicate the requests via varnish are processed
correctly.
I'm not able to reproduce the problem at will so I'd be relying on user
feedback to determine if the problem still occurs and that's unreliable
at
best.

It is of course better than having the problem occur, but I'd rather
take
the opportunity to try and get to the bottom of it while I can.  I only
deployed varnish a couple of days ago.  The site will be fairly quiet
until the end of the week.  I'll resort to pipe if I've not got a fix by
then.


-Ronan

_______________________________________________
varnish-misc mailing list
varnish-misc at varnish-cache.org
http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc




More information about the varnish-misc mailing list