Hi Willy,
Haproxy will check the number of concurrent sessions assigned to the
server after being selected from lb trees. Both leastconn and roundrobin
use the same condition as below:
fwlc_get_next_server():
if (!s->maxconn || (!s->nbpend && s->served < srv_dynamic_maxconn(s))) {
if (s != srvtoavoid) {
srv = s;
break;
}
avoided = s;
}
fwrr_get_next_server():
if (!srv->maxconn || (!srv->nbpend && srv->served <
srv_dynamic_maxconn(srv))) {
/* make sure it is not the server we are trying to exclude... */
if (srv != srvtoavoid || avoided)
break;
avoided = srv; /* ...but remember that is was selected yet avoided */
}
It means that the server will not be used if there are sessions in
pending queue or srv->served exceeds the dynamic maxconn of server with
srv->maxconn set.
But static-rr ignores the sessions in pending queue and just uses
srv->cur_sess to compare with dynamic maxconn ad below:
map_get_server_rr():
if (!srv->maxconn || srv->cur_sess < srv_dynamic_maxconn(srv)) {
/* make sure it is not the server we are try to exclude... */
if (srv != srvtoavoid) {
px->lbprm.map.rr_idx = newidx;
return srv;
}
avoided = srv; /* ...but remember that is was selected yet avoided */
avoididx = newidx;
}
So I am wondering that if there is something intentionally to use
different check condition that I have not caught.
--
Best Regards,
Godbach