varnish using dropped backend connections?

Lasse Karstensen lkarsten at
Mon Jun 17 10:55:37 CEST 2013

On Thu, Jun 13, 2013 at 12:56:27PM -0500, Nathan Warren wrote:
> My suspicion was that varnish was creating a keepalive session to the play server that was persistent. This seems to be the case with tcp sessions visible (via netstat) on both sides when no traffic is passing through. It seems as though the firewall was dropping the keepalive session, but varnish kept using it as if it were there. Then it kept re-using it over and over. After refreshing the page a few times (in error), the page will start working.

This sounds like a plausible explanation for the symptoms you are describing.

The "proper" fix is to find out which NAT/connection tracking table that
purges this entry and fix that.

If you just want to fix the problem, you can ask Varnish to stop reusing
backend connections. Of course this will give you TCP slow start on all backend
fetches, but this is usually acceptable.

Here is a VCL snippet for disabling reuse:

sub vcl_miss {
    set bereq.http.Connection = "close";

sub vcl_pass {
    set bereq.http.Connection = "close";

With regards,
Lasse Karstensen
Varnish Software AS

More information about the varnish-misc mailing list