Detecting health of Backend in Director in VCL

Stewart Robinson stewsnooze at gmail.com
Thu Jul 14 15:15:09 CEST 2011


On 14 Jul 2011, at 14:08, Chris Davies wrote:

> On Jul 14, 2011, at 9:05 AM, Shibashish wrote:
>> On Thu, Jul 14, 2011 at 6:30 PM, Chris Davies <isp at daviesinc.com> wrote:
>> I've got a director set up with three nodes, and I can see how to check the health of the director, but, is there any method to check the health of a particular backend in the director?
>> 
>> Each backend host is checked with its own probe...
>> 
>> .probe = { 
>>                .url = "/probe.cgi";
>>                .timeout = 34 ms; 
>>                .interval = 1s; 
>>                .window = 10;
>>                .threshold = 8;
>>        }
>> 
>> More at https://www.varnish-cache.org/trac/wiki/BackendPolling
> 
> And in VCL, how do I tell the health of the backend within a director?
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

You could set a header based on and then issue a restart then act on the header in vcl_recv.

This example restarts to choose a new backend  https://www.varnish-cache.org/trac/wiki/VCLExampleRestarts

And I've previously done stuff like 

  if (req.backend.healthy) {

         set req.grace = 60s;

       }

       else {

         set req.grace = 12h;

       }

so you could combine to two to push some logic through

Stew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110714/86b90965/attachment-0003.html>


More information about the varnish-misc mailing list