Hello!
If we are running with 'option redispatch' and
'retries' parameter set to some positive value,
the behaviur is as follows:
#######################
In order to avoid immediate reconnections to a server which is restarting,
a turn-around timer of 1 second is applied before a retry occurs.
When "option redispatch" is set, the last retry may be performed on another
server even if a cookie references a different server.
#######################
While is makes sence to wait for some time (1 second)
before attempting another connection to the same
server, there is no reason to wait 1 second before
attempting the last connection to another server
(with option redispatch). It is just a waste of one
second.
Please consider the following patch to attempt last try
immediately. (If our main server does not respond, there is
no reason to assume another one cant answer now).
PS: another important suggestion is to make that delay tunable
parameter (like timeout.connect, etc), rather than hardcode
1000ms in code.
Thanks in advance.
--- work/haproxy-1.4-dev2/src/session.c 2009-08-10 00:57:09.000000000 +0400
+++ /tmp/session.c 2009-08-31 14:28:26.000000000 +0400
@@ -306,7 +306,11 @@ int sess_update_st_cer(struct session *s
si->err_type = SI_ET_CONN_ERR;
si->state = SI_ST_TAR;
+ if (s->srv && s->conn_retries == 0 && s->be->options & PR_O_REDISP) {
+ si->exp = tick_add(now_ms, MS_TO_TICKS(0));
+ } else {
si->exp = tick_add(now_ms, MS_TO_TICKS(1000));
+ }
return 0;
}
return 0;