Debian – Varnish going sick

apache-2.2cachedebianvarnish

I'm having trouble with Varnish, it works for a couple of views and then just goes sick… The weird thing is that it does work for about 20 or 30 requests. If I call apache directly it works fine. I'm running Varnish Version: 3.0.3-1 on Debian Squeeze and, for now, Apache on port 80 and Varnish on port 8080 on the same server..

I'm using https://github.com/mattiasgeniar/varnish-3.0-configuration-templates as base for my VCLs and modified the VCLs to support Concrete5.

Anyone any clue on how I should debug this?

backend default {
    .host = "127.0.0.1";
    .port = "80";
    .connect_timeout = 1.5s; 
    .first_byte_timeout = 45s; 
    .between_bytes_timeout = 30s; 
    .probe = {
        .url = "/";
        .timeout  = 1s;
        .interval = 10s;
        .window    = 10;
        .threshold = 8;
    }
}

LOG

    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1353791312 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1353791315 1.0
    0 Backend_health - default Still sick 4--X-R- 0 8 10 0.000689 0.000000 HTTP/1.1 301 Moved Permanently

(the 301 is because I check for www.)

Best Answer

Your backend is responding with a 301 to the health check; only 200 is an expected "healthy" response by default. Change your probe:

.probe = {
    .url = "/";
    .timeout  = 1s;
    .interval = 10s;
    .window    = 10;
    .threshold = 8;
    .expected_response = 301;
}

Edit :

Here is the reason why the log returned ok in the beginning but after a while it would drop one by one to eventually the state of sick : The settings for .interval, .threshold, and .window - the health checks were getting an "unhealthy" response but they didn't consider the worker to be sick until they had gotten enough bad responses to drop the number of successes in the window to under the threshold

Related Topic