]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: counters: dispatch counters over thread groups
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 15 May 2025 17:55:11 +0000 (19:55 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 5 Jun 2025 07:59:38 +0000 (09:59 +0200)
commit16eb0fab319dae5cfde1b69de8927c757e1dba78
tree31844c07dc37674a385ad2cbefe8910c64607252
parent12c3ffbb48cfd3f4833d7a7ad636fe50ea135e73
MAJOR: counters: dispatch counters over thread groups

Most fe and be counters are good candidates for being shared between
processes. They are now grouped inside "shared" struct sub member under
be_counters and fe_counters.

Now they are properly identified, they would greatly benefit from being
shared over thread groups to reduce the cost of atomic operations when
updating them. For this, we take the current tgid into account so each
thread group only updates its own counters. For this to work, it is
mandatory that the "shared" member from {fe,be}_counters is initialized
AFTER global.nbtgroups is known, because each shared counter causes the stat
to be allocated lobal.nbtgroups times. When updating a counter without
concurrency, the first counter from the array may be updated.

To consult the shared counters (which requires aggregation of per-tgid
individual counters), some helper functions were added to counter.h to
ease code maintenance and avoid computing errors.
29 files changed:
include/haproxy/backend.h
include/haproxy/counters-t.h
include/haproxy/counters.h
include/haproxy/proxy.h
include/haproxy/server.h
include/haproxy/stream.h
src/backend.c
src/cache.c
src/check.c
src/counters.c
src/fcgi-app.c
src/flt_http_comp.c
src/frontend.c
src/haproxy.c
src/hlua.c
src/http_act.c
src/http_ana.c
src/listener.c
src/log.c
src/mux_h1.c
src/proxy.c
src/queue.c
src/server.c
src/server_state.c
src/stats-file.c
src/stats-proxy.c
src/stream.c
src/tcp_act.c
src/tcp_rules.c