MINOR: queues: Check minconn first in srv_dynamic_maxconn()

In srv_dynamic_maxconn(), we'll decide that the max number of connection
is the server's maxconn if 1) the proxy's number of connection is over
fullconn, or if minconn was not set.
Check if minconn is not set first, as it will be true most of the time,
and as the proxy's "beconn" variable is in a busy cache line, it can be
costly to access it, while minconn/maxconn is in a cache line that
should very rarely change.
This commit is contained in:
Olivier Houchard 2026-02-11 07:53:21 +01:00
parent c622ed23c8
commit a8f50cff7e

View File

@ -105,11 +105,8 @@ unsigned int srv_dynamic_maxconn(const struct server *s)
{
unsigned int max;
if (s->proxy->beconn >= s->proxy->fullconn)
/* no fullconn or proxy is full */
max = s->maxconn;
else if (s->minconn == s->maxconn)
/* static limit */
if (s->minconn == s->maxconn || s->proxy->beconn >= s->proxy->fullconn)
/* static limit, or no fullconn or proxy is full */
max = s->maxconn;
else max = MAX(s->minconn,
s->proxy->beconn * s->maxconn / s->proxy->fullconn);