diff --git a/doc/configuration.txt b/doc/configuration.txt index 6116f25d3..4d413be5f 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -13452,9 +13452,13 @@ maxqueue will wait in the queue for this server. If this limit is reached, next requests will be redispatched to other servers instead of indefinitely waiting to be served. This will break persistence but may allow people to - quickly re-log in when the server they try to connect to is dying. The - default value is "0" which means the queue is unlimited. See also the - "maxconn" and "minconn" parameters. + quickly re-log in when the server they try to connect to is dying. Some load + balancing algorithms such as leastconn take this into account and accept to + add requests into a server's queue up to this value if it is explicitly set + to a value greater than zero, which often allows to better smooth the load + when dealing with single-digit maxconn values. The default value is "0" which + means the queue is unlimited. See also the "maxconn" and "minconn" parameters + and "balance leastconn". max-reuse The "max-reuse" argument indicates the HTTP connection processors that they diff --git a/src/backend.c b/src/backend.c index 34e5e7aac..e0f7dd627 100644 --- a/src/backend.c +++ b/src/backend.c @@ -652,7 +652,7 @@ int assign_server(struct stream *s) * know it's because all servers are full. */ if (s->be->nbpend && - (((s->be->lbprm.algo & BE_LB_KIND) == BE_LB_KIND_CB) || // conn-based: leastconn & first + (((s->be->lbprm.algo & (BE_LB_KIND|BE_LB_NEED|BE_LB_PARM)) == BE_LB_ALGO_FAS)|| // first ((s->be->lbprm.algo & (BE_LB_KIND|BE_LB_NEED|BE_LB_PARM)) == BE_LB_ALGO_RR) || // roundrobin ((s->be->lbprm.algo & (BE_LB_KIND|BE_LB_NEED|BE_LB_PARM)) == BE_LB_ALGO_SRR))) { // static-rr err = SRV_STATUS_FULL; diff --git a/src/lb_fwlc.c b/src/lb_fwlc.c index c7e0dd801..bf5ae61a7 100644 --- a/src/lb_fwlc.c +++ b/src/lb_fwlc.c @@ -323,7 +323,7 @@ struct server *fwlc_get_next_server(struct proxy *p, struct server *srvtoavoid) struct server *s; s = eb32_entry(node, struct server, lb_node); - if (!s->maxconn || (!s->nbpend && s->served < srv_dynamic_maxconn(s))) { + if (!s->maxconn || s->served + s->nbpend < srv_dynamic_maxconn(s) + s->maxqueue) { if (s != srvtoavoid) { srv = s; break;