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);
}
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.