]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: queue: update px->served and lb's take_conn once per loop
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Jun 2021 05:47:08 +0000 (07:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Jun 2021 08:09:40 +0000 (10:09 +0200)
commit9cef43acab5137657deea9e1189a1bd7b163f6fb
treee6a81bf22967af2998912203e140726fce801d62
parenta48905bad89e7528035ba7eab3832d4363626f77
MEDIUM: queue: update px->served and lb's take_conn once per loop

There's no point doing atomic incs over px->served/px->totpend under the
locks from the inner loop, as this value is used by the LB algorithms but
not during the dequeuing step. In addition, the LB algo's take_conn()
doesn't need to be refreshed for each and every connection taken
under the lock, it can be performed once at the end and out of the
lock.

While the gain on roundrobin is not noticeable (only the atomic inc),
on leastconn which uses take_conn(), the performance increases from
355k to 362k req/s on 16 threads.
src/queue.c