[Varnish] #1658: Hash and Random director is deflected at the health-check failover
Varnish
varnish-bugs at varnish-cache.org
Sun Jan 11 23:10:58 CET 2015
#1658: Hash and Random director is deflected at the health-check failover
-------------------+--------------------
Reporter: xcir | Type: defect
Status: new | Priority: normal
Milestone: | Component: vmod
Version: trunk | Severity: normal
Keywords: |
-------------------+--------------------
I have noticed that failover is deflected.
If health-check failures, select to other backend.
But, selected backend is near for seed is same.
--vcl
{{{
vcl 4.0;
import directors;
backend b1 { .host = "127.0.0.1";.port = "88";}
backend b2 { .host = "127.0.0.1";.port = "88";}
backend b3 { .host = "127.0.0.1";.port = "88";}
backend b4 { .host = "127.0.0.1";.port = "88";}
sub vcl_init{
new ws_rand = directors.random();
ws_rand.add_backend(b1, 1.0);
ws_rand.add_backend(b2, 1.0);
ws_rand.add_backend(b3, 1.0);
ws_rand.add_backend(b4, 1.0);
}
sub vcl_recv{
set req.backend_hint = ws_rand.backend();
return(pass);
}
}}}
--command
{{{
test:
#ab -n 1200 -c1 http://localhost/
get log:
# varnishlog -graw -ibackend> z
# cat z|sed -e 's/\s\+/\t/g'|cut -f 7|sort | uniq -c
}}}
--log
{{{
All backend is healthy:
298 b1(127.0.0.1,,88)
313 b2(127.0.0.1,,88)
304 b3(127.0.0.1,,88)
285 b4(127.0.0.1,,88)
b1 is sick:
605 b2(127.0.0.1,,88)<-It's heavy..
307 b3(127.0.0.1,,88)
288 b4(127.0.0.1,,88)
b2 is sick:
388 b1(127.0.0.1,,88)
519 b3(127.0.0.1,,88)
293 b4(127.0.0.1,,88)
b3 is sick:
325 b1(127.0.0.1,,88)
488 b2(127.0.0.1,,88)
387 b4(127.0.0.1,,88)
b4 is sick:
301 b1(127.0.0.1,,88)
310 b2(127.0.0.1,,88)
589 b3(127.0.0.1,,88)
}}}
I've created a patch to re-hash the seed at the failover.
--log(patched)
{{{
All backend is healthy:
294 b1(127.0.0.1,,88)
303 b2(127.0.0.1,,88)
318 b3(127.0.0.1,,88)
285 b4(127.0.0.1,,88)
b1 is sick:
356 b2(127.0.0.1,,88)
429 b3(127.0.0.1,,88)
415 b4(127.0.0.1,,88)
b2 is sick:
439 b1(127.0.0.1,,88)
366 b3(127.0.0.1,,88)
395 b4(127.0.0.1,,88)
b3 is sick:
425 b1(127.0.0.1,,88)
394 b2(127.0.0.1,,88)
381 b4(127.0.0.1,,88)
b4 is sick:
394 b1(127.0.0.1,,88)
405 b2(127.0.0.1,,88)
401 b3(127.0.0.1,,88)
}}}
--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1658>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list