0

have a varnish server with 3 backends. all backends are apache. everything is ok and the varnish server caches everything I need, and the connections are OK. I wnat to monitor the health of web servers. and in case of a failure, varnish does not send reuests to the failed web server. The problem is that when I enable the probe for all backedns I get the 503 error! If i enablle it on one or two backends, everything is OK, but when I enable it for 3 backends I get the 503 error. here's varnish configuration for backends and health checking:

vcl 4.0;

import directors;

probe backend_healthcheck {
   .url = "/";
   .timeout = 34 ms;
   .window = 5;
   .threshold = 3;
   .interval = 1s;

}

backend web1 {
    .host = "192.168.1.16";
    .port = "8080";
    .probe = backend_healthcheck;
}

backend web2 {
    .host = "192.168.1.18";
    .port = "8080";
    .probe = backend_healthcheck;
}

backend web3 {
    .host = "192.168.1.20";
    .port = "8080";
    .probe = backend_healthcheck;
}

 sub vcl_init {
    new apache = directors.round_robin();
    apache.add_backend(web1);
    apache.add_backend(web2);
    apache.add_backend(web3);
}

1 Answers1

0

It is very likely that your health check takes longer than 34 ms to complete, so try to adjust it to 3s or higher:

probe backend_healthcheck {
   .url = "/";
   .timeout = 3s;
   .window = 5;
   .threshold = 3;
   .interval = 1s;
}

Monitor the status of your probes with varnishlog -g raw -i Backend_health and post the output here if the above doesn't help.

Danila Vershinin
  • 8,725
  • 2
  • 29
  • 35
  • Thank you. We resolved the problem with the command you sent. varnishlog -g raw -i Backend_health: `Backend_health - web3 Still sick 4--X-R- 0 3 5 0.000803 0.000000 HTTP/1.1 403 Forbidden` I added `expected_response = 403;` to the probe section and the problem resolved. Thank you. – behnam bahadori May 08 '17 at 08:11