]> git.ipfire.org Git - thirdparty/haproxy.git/commit
OPTIM: global: move byte counts out of global and per-thread
authorWilly Tarreau <w@1wt.eu>
Thu, 12 Jan 2023 15:08:41 +0000 (16:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 12 Jan 2023 15:37:45 +0000 (16:37 +0100)
commit6be8d09a614c37676fcdbb59776667cef817b8f8
treedfa44590386a9b0192f19b93713c974d9869b4d4
parent522841c47bba8bdd5c3b26b2eac564e8ca066ef6
OPTIM: global: move byte counts out of global and per-thread

During multiple tests we've already noticed that shared stats counters
have become a real bottleneck under large thread counts. With QUIC it's
pretty visible, with qc_snd_buf() taking 2.5% of the CPU on a 48-thread
machine at only 25 Gbps, and this CPU is entirely spent in the atomic
increment of the byte count and byte rate. It's also visible in H1/H2
but slightly less since we're working with larger buffers, hence less
frequent updates. These counters are exclusively used to report the
byte count in "show info" and the byte rate in the stats.

Let's move them to the thread_ctx struct and make the stats reader
just collect each thread's stats when requested. That's way more
efficient than competing on a single cache line.

After this, qc_snd_buf has totally disappeared from the perf profile
and tests made in h1 show roughly 1% performance increase on small
objects.
include/haproxy/global-t.h
include/haproxy/tinfo-t.h
src/quic_sock.c
src/raw_sock.c
src/stats.c