]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: streams: use one list per stream instead of a global one
authorWilly Tarreau <w@1wt.eu>
Wed, 24 Feb 2021 09:37:01 +0000 (10:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Feb 2021 12:53:20 +0000 (13:53 +0100)
commita698eb6739b502d957da773e121ef40833f818dc
treecf37b3d541097597d57b82a78c53bf28ddfda9c7
parent5d533e2bad668f10e5b00c24b7593847149a6be2
MINOR: streams: use one list per stream instead of a global one

The global streams list is exclusively used for "show sess", to look up
a stream to shut down, and for the hard-stop. Having all of them in a
single list is extremely expensive in terms of locking when using threads,
with performance losses as high as 7% having been observed just due to
this.

This patch makes the list per-thread, since there's no need to have a
global one in this situation. All call places just iterate over all
threads. The most "invasive" changes was in "show sess" where the end
of list needs to go back to the beginning of next thread's list until
the last thread is seen. For now the lock was maintained to keep the
code auditable but a next commit should get rid of it.

The observed performance gain here with only 4 threads is already 7%
(350krps -> 374krps).
include/haproxy/applet-t.h
include/haproxy/stream-t.h
include/haproxy/stream.h
include/haproxy/tinfo-t.h
src/proxy.c
src/stream.c