]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: queue: take the proxy lock only during the px queue accesses
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Jun 2021 06:04:24 +0000 (08:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Jun 2021 08:52:31 +0000 (10:52 +0200)
commit49667c14ba15e0798be145635c80c809ffeaa44b
tree4788d3f635b02d2a51c0ff6c2b1ff9b09329f208
parent98c8910be748fa3a3f3ff6bff77b89177f5fd350
MEDIUM: queue: take the proxy lock only during the px queue accesses

There's no point keeping the proxy lock held for a long time, it's
only needed when checking the proxy's queue, and keeping it prevents
multiple servers from dequeuing in parallel. Let's move it into
pendconn_process_next_strm() and release it ASAP. The pendconn
remains under the server queue lock's protection, guaranteeing that
no stream will release it while it's being touched.

For roundrobin, the performance increases by 76% (327k to 575k) on
16 threads. Even with a single server and maxconn=100, the performance
increases from 398 to 496 kreq/s. For leastconn, almost no change is
visible (less than one percent) but this is expected since most of the
time there is spent in fwlc_reposition() and fwlc_get_next_server().
src/queue.c