[PATCH] Random director tries all backends before giving up

Jack Lindamood jack at facebook.com
Mon Apr 12 01:35:13 CEST 2010


The following is a patch I've made to varnish that I hope improves the random director: which anyone's welcome to use (even varnish trunk?).  My motivation was to reduce the number of vcl_error calls when a director is mostly good.  You can get the entire patch at this link.



http://github.com/cep21/Varnish/commit/6f5e98143ac2636504d9febf574b14c3c1a072fc



Here's the commit message:



Random director tries all backends before giving up



Summary:

The current random director gives up when it can't get a FD to the backend it wants retries times in a row.  Rather than give up and return NULL, which is guaranteed to cause a vcl_error, as a last ditch effort we try all other healthy backends until we get one that works.  This is mostly useful in the between time after a backend server dies and before the health check fails enough to mark a backend unhealthy.



Backwards Compatibility =  Not strictly backwards compatible.  In cases when the old code would of fallen through to vcl_error this will give a shot at getting a good result.



Performance = In the worse case, this will add extra calls for getting a FD, but only for situations that vcl_error



Test Plan: New varnish unittest.  It fails in the old code and works in this new code.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20100411/edb30834/attachment-0003.html>


More information about the varnish-dev mailing list