Skip to content

Varnish 2.0 backend health polling and Zope 2.10.

January 13, 2009

Amongst the neat features of Varnish 2.0 is backend health polling, so that Varnish keeps track of if the backend is up and running. You can from this information do various things like loads balancing etc. I’ve been spending the day on trying this out, and failing miserably. Thanks to some help from Paul-Henning Kamp and Tollef Fog Heen from Linpro I’ve figured out the problem.

Varnish, when doing the health polling, will send a request and the “half-close” the TCP connection. This is standard practice in TCP, and it is like saying “OK, I am done, close the connection when you are done.” So, Zope should finish the request and the close the connection. However, Zope 2.10 will close the connection immediately, and THEN finish the request. The result is that Varnish will see the poll as failed, so backend health polling against Zope 2.10 will not work.

What most likely will solve this problem is putting an Apache inbetween. Also, if you are load balancing with Pound, that probably will avoid it, although I haven’t tried this out yet. The goal of this is to see if we can get Varnish to serve cached pages when the server is down, even if the cached pages really has timed out. If I suceed in this, I will make a follow-up.


From → plone, zope

  1. Hi Lennart,

    there is an option in zope.conf:

    # valid keys are “address” and “force-connection-close”
    address 8083
    # force-connection-close on

    Maybe if you set force-connection-close it works as expected.

    HTH Christian

    • No, that forces the connection to close even if the client doesn’t request it to. I tried to make sure it doesn’t change the behavior of half-closed connections, but it doens’t seem to make a difference.

  2. Man I have been playing forever with this trying to figure out how to check the health of my backends. glad I at least have an explanation now. Thanks!

  3. I just spent the better part of two days trying to work out what’s going on here, how I wish I had the foresight to google for “zope varnish problems” rather than the more specific terms I did google for.

    Basically, the moment you call the shutdown(2) syscall, zope stops talking to you. An easy patch may be to change varnish not to half-close the connection. I even wrote a C-program to illustrate the problem and posted this issue to zope-dev because I was convinced the issue isn’t known yet.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: