diff options
author | Willy Tarreau <w@1wt.eu> | 2014-06-13 17:49:40 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2014-06-13 17:53:55 +0200 |
commit | 33a14e515bdbb02d8193bd870f3b659243a851f9 (patch) | |
tree | 6b1b84f7d77e9021270f6edc5c51591de9f55721 | |
parent | db6d012270be8184a287aabc7f670e209b243aa6 (diff) | |
download | haproxy-33a14e515bdbb02d8193bd870f3b659243a851f9.tar.gz |
MEDIUM: session: redispatch earlier when possible
As discussed with Dmitry Sivachenko, is a server farm has more than one
active server, uses a guaranteed non-determinist algorithm (round robin),
and a connection was initiated from a non-persistent connection, there's
no point insisting to reconnect to the same server after a connect failure,
better redispatch upon the very first retry instead of insisting on the same
server multiple times.
-rw-r--r-- | src/session.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/session.c b/src/session.c index 0ef612dbb..4412125ba 100644 --- a/src/session.c +++ b/src/session.c @@ -879,8 +879,15 @@ static int sess_update_st_cer(struct session *s, struct stream_interface *si) * we must mark the session unassigned, and eventually clear the DIRECT * bit to ignore any persistence cookie. We won't count a retry nor a * redispatch yet, because this will depend on what server is selected. + * If the connection is not persistent, the balancing algorithm is not + * determinist (round robin) and there is more than one active server, + * we accept to perform an immediate redispatch without waiting since + * we don't care about this particular server. */ - if (objt_server(s->target) && si->conn_retries == 0 && + if (objt_server(s->target) && + (si->conn_retries == 0 || + (!(s->flags & SN_DIRECT) && s->be->srv_act > 1 && + ((s->be->lbprm.algo & BE_LB_KIND) == BE_LB_KIND_RR))) && s->be->options & PR_O_REDISP && !(s->flags & SN_FORCE_PRST)) { sess_change_server(s, NULL); if (may_dequeue_tasks(objt_server(s->target), s->be)) |