Backend connection failure

Stefan Pommerening pom at dmsp.de
Thu May 26 18:00:29 CEST 2011


Hi all,

for a longer time I notice a few backend connection failures 
('backend_fail' in varnishstat).
It occurs about 1-2 times per hour (on varnish 2.1.5 serving about 600 
req/sec).

I wrote a small perl script (attached) in order to hunt down this error.
My plan was to check the 'backend_fail' parameter by cyclic checks using 
'varnishstat' and to dump the shared log memory using 'varnishlog' if 
the number increases.

The only interesting message (grepping for 'fail' and 'error') I got is 
the following:
   456 Debug        c "Write error, retval = 39424, len = 140216, errno 
= Connection reset by peer"

Does anyone has an idea what the issue could be? Might this be solved by 
changing some varnish parameters? If yes, which ones?

Any hint is very appreciated. Thanks a lot in advance.

Stefan

-*-*-*-
Here is my short (q&d) perl script (maybe it also helps others to hunt 
other issues)...


#!/usr/bin/perl

my $last_be_fail = &Fetch_Backend_Fail();

my $curr_be_fail;

my $dumps = 10;

while (1) {

    print "\n";

    sleep 10;

    $curr_be_fail = &Fetch_Backend_Fail();

    print "cmp[$curr_be_fail][$last_be_fail] ";

    if ($curr_be_fail > $last_be_fail) {

if ($dumps > 0) {

&Dump_Varnishlog();

          $dumps--;

}

       $last_be_fail = $curr_be_fail;

    }

}

sub Fetch_Backend_Fail {

    my $VARNISHSTAT = "/usr/bin/varnishstat -n port80 -1 | /usr/bin/grep 
backend_fail | /usr/bin/awk '{ print \$2 }'";

    my $be_fail     = `$VARNISHSTAT`;

    chomp $be_fail;

    my $date = `/bin/date +"%Y-%m-%d %H:%M:%S"`;

    chomp $date;

    print "$date: backend_fail:[$be_fail] ";

    return $be_fail;

}

sub Dump_Varnishlog {

    my $date = `/bin/date +"%Y%m%d%H%M%S"`;

    chomp $date;

    my $VARNISHLOG = "/usr/bin/varnishlog -d -n port80 > 
/var/tmp/varnishlog.$date.log";

print "Schreibe Logdatei...\n$VARNISHLOG\n";

    `$VARNISHLOG`;

}

1;

-- 

*Dipl.-Inform. Stefan Pommerening
Informatik-Büro: IT-Dienste & Projekte, Consulting & Coaching*
http://www.dmsp.de <http://www.dmsp.de/>






More information about the varnish-misc mailing list