我有一个架构,其中两个 varnish 服务器位于 5 个 webhead 前面。每个 varnish 服务器都配置了一个循环后端控制器,但在负载中等到高的时候,varnish 似乎更倾向于列表中第一个定义的后端。
Varnish版本是3.0.5。
如果第一个后端被标记为有问题,则列表中的第二个后端将受到高度青睐,依此类推。
varnish> backend.list
200
Backend name Refs Admin Probe
web1(************,,8080) 102 probe Healthy 8/8
web2(************,,8080) 17 probe Healthy 8/8
web3(************,,8080) 9 probe Healthy 8/8
web4(************,,8080) 17 probe Healthy 8/8
web5(************,,8080) 12 probe Healthy 8/8
VCL 中可能相关的一些部分:
probe healthcheck {
.request =
"GET /LICENSE.txt HTTP/1.1"
"Host: **********.co.uk"
"Connection: close";
.interval = 120s;
.timeout = 90s; # High values due to expected slow responses
.window = 8;
.threshold = 3;
.initial = 3;
#.expected_response = 200; # Still want the Magento maintenance page to display so no response code check
}
backend web1 {
.host = "************";
.port = "8080";
.connect_timeout = 240s; # High values due to expected slow responses
.first_byte_timeout = 240s; # High values due to expected slow responses
.between_bytes_timeout = 240s; # High values due to expected slow responses
.probe = healthcheck;
}
backend web2 {
.host = "************";
.port = "8080";
.connect_timeout = 240s; # High values due to expected slow responses
.first_byte_timeout = 240s; # High values due to expected slow responses
.between_bytes_timeout = 240s; # High values due to expected slow responses
.probe = healthcheck;
}
backend web3 {
.host = "************";
.port = "8080";
.connect_timeout = 240s; # High values due to expected slow responses
.first_byte_timeout = 240s; # High values due to expected slow responses
.between_bytes_timeout = 240s; # High values due to expected slow responses
.probe = healthcheck;
}
backend web4 {
.host = "************";
.port = "8080";
.connect_timeout = 240s; # High values due to expected slow responses
.first_byte_timeout = 240s; # High values due to expected slow responses
.between_bytes_timeout = 240s; # High values due to expected slow responses
.probe = healthcheck;
}
backend web5 {
.host = "************";
.port = "8080";
.connect_timeout = 240s; # High values due to expected slow responses
.first_byte_timeout = 240s; # High values due to expected slow responses
.between_bytes_timeout = 240s; # High values due to expected slow responses
.probe = healthcheck;
}
director backend_director round-robin {
{ .backend = web1; }
{ .backend = web2; }
{ .backend = web3; }
{ .backend = web4; }
{ .backend = web5; }
}
sub vcl_recv {
set req.backend = backend_director;
# loads more stuff
}
有人能解释一下为什么循环调度控制器会如此偏爱第一个定义的后端吗?或者什么可能导致完全绕过控制器?我已经确保return(pipe)
在 vcl_recv 中不会使用它。