From: Willy Tarreau Date: Fri, 13 Jun 2014 15:40:15 +0000 (+0200) Subject: MEDIUM: session: don't apply the retry delay when redispatching X-Git-Tag: v1.5.0~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=db6d012270be8184a287aabc7f670e209b243aa6;p=thirdparty%2Fhaproxy.git MEDIUM: session: don't apply the retry delay when redispatching The retry delay is only useful when sticking to a same server. During a redispatch, it's useless and counter-productive if we're sure to switch to another server, which is almost guaranteed when there's more than one server and the balancing algorithm is round robin, so better not pass via the turn-around state in this case. It could be done as well for leastconn, but there's a risk of always killing the delay after the recovery of a server in a farm where it's almost guaranteed to take most incoming traffic. So better only kill the delay when using round robin. --- diff --git a/src/session.c b/src/session.c index 414ff65c69..0ef612dbb0 100644 --- a/src/session.c +++ b/src/session.c @@ -910,8 +910,13 @@ static int sess_update_st_cer(struct session *s, struct stream_interface *si) if (!si->err_type) si->err_type = SI_ET_CONN_ERR; - si->state = SI_ST_TAR; - si->exp = tick_add(now_ms, MS_TO_TICKS(delay)); + /* only wait when we're retrying on the same server */ + if (si->state == SI_ST_ASS || + (s->be->lbprm.algo & BE_LB_KIND) != BE_LB_KIND_RR || + (s->be->srv_act <= 1)) { + si->state = SI_ST_TAR; + si->exp = tick_add(now_ms, MS_TO_TICKS(delay)); + } return 0; } return 0;