Is it possible in Varnish 3 to configure a backend to have multiple probes?
I have multiple varnish servers and multiple backend servers running Drupal. I've configured a basic 1 second interval healthcheck PHP file to verify the health of the application server, but I would also like to use a healthcheck for the Drupal stack, however this check would need to run less often than the basic healthcheck. e.g.: Every 5 seconds it could check the Drupal stack.
Is it possible to use 2 separate probes on a single backend for such a case?
Theoretical configuration:
probe healthcheck {
.url = "/healthcheck.php";
.interval = 1s;
.timeout = 100 ms;
.window = 5;
.threshold = 5;
}
probe drupalcheck {
.url = "/index.php";
.interval = 5s;
.timeout = 5s;
.window = 5;
.threshold = 5;
}
backend apache_1 {.host = "server01"; .port = "8080"; .probe = healthcheck; .probe = drupalcheck}
backend apache_2 {.host = "server02"; .port = "8080"; .probe = healthcheck; .probe = drupalcheck}
backend apache_3 {.host = "server03"; .port = "8080"; .probe = healthcheck; .probe = drupalcheck}
Quick answer: no.
Longer answer: You can specify as many backends to a single actual backend server, and each can have it's own probe. You can then route traffic to them as you want.
You could also call something like a 'probe-check' script on your application server via the probe call, which could do it's own status checks. You're just calling a php/python/etc script anyway, so it can be a script you created.
There's more (not totally relevant) here: https://www.varnish-cache.org/lists/pipermail/varnish-misc/2011-October/021298.html
The probe just checks the header returned. Thus you can have ohne script
/probe.php
which first sends a request to/healthcheck.php
and afterwards another one toindex.php
.Inside
/probe.php
you can use$headers = get_headers($url,1);
and analyze for a 40X or 50X return code on each of the urls.At the end: