client and fallback director questions.

James A. Robinson jim.robinson at stanford.edu
Fri Oct 4 01:54:58 CEST 2013


On Thu, Oct 3, 2013 at 4:01 PM, James A. Robinson <jim.robinson at stanford.edu
> wrote:

> I forgot that I'd need to set
>
>   set req.backend = member
>
> within each of those, but testing out the rest of the
> configuration as I outlined seems to work as I
> expected.
>
> If I simulate a failure by using .probe that will
> never succeed, I see traffic for one group get
> routed from its original server to a new one,
> and when the .probe is reset to recover I see
> the traffic move back.
>

Last note:  Setting up multiple director pools and weighting a
"primary" node higher than the others appears to allow for fine
grained control over which host serves the content.  If the primary
dies then the remaining nodes in the pool take over.

So for a given set of backends:

backend b1 {
.host = "b1.example.org";
 .port = "80";
.probe = {
.url = "/";
 .timeout = 34 ms;
.interval = 1s;
.window = 10;
 .threshold = 8;
        }
}

backend b2 {
.host = "b2.example.org";
.port = "80";
 .probe = {
.url = "/";
.timeout = 34 ms;
 .interval = 1s;
.window = 10;
.threshold = 8;
        }
}

backend b3 {
.host = "b3.example.org";
 .port = "80";
.probe = {
.url = "/";
 .timeout = 34 ms;
.interval = 1s;
.window = 10;
 .threshold = 8;
        }
}

define n pools, weighting a "primary" backend
and having the remaining evently weighted if
the primary dies:

director b1_pool client {
{
.backend = b1;
 .weight = 10;
}
{
 .backend = b2;
.weight = 1;
}
 {
.backend = b3;
.weight = 1;
 }
}

director b2_pool client {
 {
.backend = b1;
.weight = 1;
 }
{
.backend = b2;
 .weight = 10;
}
{
 .backend = b3;
.weight = 1;
}
}

director b3_pool client {
{
 .backend = b1;
.weight = 1;
}
 {
.backend = b2;
.weight = 1;
 }
{
.backend = b3;
 .weight = 10;
}
}

and in sub vcl_recv { ... } we set

if (req.url ~ "^/(a|b|c|d)[\.\/]") {
set req.backend = b1_pool
 set client.identity = "b1"
}
else if (req.url ~ "^/(e|f|g|h)[\.\/]") {
 set req.backend = b2_pool
set client.identity = "b2"
}
else
set req.backend = b3_pool
set client.identity = "b3"
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20131003/f0b3985a/attachment.html>


More information about the varnish-misc mailing list