<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<base href="x-msg://7/">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.apple-style-span
{mso-style-name:apple-style-span;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks for the feedback. While not an issue in my case, a
configuration parameter that limits the number of backends to try could be
useful for others. I don't know how most people use varnish, but
potentially triggering vcl_error when a single backend shuts down is probably
undesirable behavior for most users. <o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
varnish-dev-bounces@varnish-cache.org
[mailto:varnish-dev-bounces@varnish-cache.org] <b>On Behalf Of </b>Adrian Otto<br>
<b>Sent:</b> Sunday, April 11, 2010 7:51 PM<br>
<b>To:</b> varnish-dev@varnish-cache.org<br>
<b>Subject:</b> Re: [PATCH] Random director tries all backends before giving up<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>Jack,<o:p></o:p></p>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>This approach is probably not a good idea if (a) you have a
large cluster, (b) a heavily loaded cluster, and/or (c) if your backends are
sensitive to overload. You are likely to trigger a cascading failure. It might
be smarter to have a configurable number of backends to try... perhaps 2 or 3.
Imagine if you have 50 backends. There is no point in trying 50 times to find a
healthy backend. Changes are that if 25% of your backends are down, trying more
is just going to exacerbate the problem. <o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
<div>
<p class=MsoNormal>Adrian<o:p></o:p></p>
</div>
<div>
<p class=MsoNormal><o:p> </o:p></p>
<div>
<div>
<p class=MsoNormal>On Apr 11, 2010, at 4:35 PM, Jack Lindamood wrote:<o:p></o:p></p>
</div>
<p class=MsoNormal><br>
<br>
<o:p></o:p></p>
<div>
<div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>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.<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'><a
href="http://github.com/cep21/Varnish/commit/6f5e98143ac2636504d9febf574b14c3c1a072fc">http://github.com/cep21/Varnish/commit/6f5e98143ac2636504d9febf574b14c3c1a072fc</a><o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>Here’s
the commit message:<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>Random
director tries all backends before giving up<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>Summary:<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>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.<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>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.<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>Performance
= In the worse case, this will add extra calls for getting a FD, but only for
situations that vcl_error<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'>Test
Plan: New varnish unittest. It fails in the old code and works in this
new code.<o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:10.5pt;font-family:Consolas'> <o:p></o:p></span></p>
</div>
<div>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><span style='font-size:13.5pt;font-family:"Helvetica","sans-serif"'>_______________________________________________<br>
varnish-dev mailing list<br>
<a href="mailto:varnish-dev@varnish-cache.org">varnish-dev@varnish-cache.org</a><br>
<a href="http://lists.varnish-cache.org/mailman/listinfo/varnish-dev">http://lists.varnish-cache.org/mailman/listinfo/varnish-dev</a><o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</div>
</body>
</html>