]> git.kaiwu.me - haproxy.git/commit
MAJOR: proxy: convert proxies_list to a doubly linked struct list
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 16 Jan 2026 08:26:56 +0000 (09:26 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Jul 2026 14:03:20 +0000 (16:03 +0200)
commitb6bb1bd741930cff6bd3c25a1a32918374702003
tree67fe969a983fe1feb0b6ca233a569675b5b79a83
parent164d05706132107a405d23663dbca29916910f55
MAJOR: proxy: convert proxies_list to a doubly linked struct list

Frontend, backend and listen proxies are all stored in <proxies_list>
which contain all user visible entries. This list is read in several
places, for example during stats dump.

Dynamic backend have just been introduced in the previous 3.4 release,
with creation and removal of new instances at runtime. The main
bottleneck of these operation is the manipulation of <proxies_list> due
to its singly linked nature.

This patch converts <proxies_list> into a doubly linked standard list
type. Proxy member <el> is reused as attach point. It is already used
for internal proxies in other list, not intersecting with this usage.
The main benefit of this change is to improve performance for add and
delete backend operations. It is labelled as major as it may break
external components which manipulate this list.

Also, old naming <proxies_list> has been replaced by <main_proxies>.
This helps to differentiate with the already existing superset <proxies>
list which contain all proxies instances, even internal ones. In the
future, it should be sufficient to only keep the latter list. However,
this requires careful code analysis, in particular to ensure proxies
iteration are always executed with the proper capabilities filter.

Proxies reversal on post parsing has been updated to use the new list
format. This will be removed in a latter patch as it is now possible to
insert proxies in the order of their parsing in constant time. Most of
the other changes are straightforward : for/while statements are
replaced by list_for_each_entry(). For incomplete iteration, recently
introduced iteration wrappers are updated to use LIST macros.
21 files changed:
include/haproxy/proxy-t.h
include/haproxy/proxy.h
src/cache.c
src/cfgdiag.c
src/cfgparse.c
src/check.c
src/debug.c
src/fcgi-app.c
src/filters.c
src/haproxy.c
src/haterm.c
src/limits.c
src/log.c
src/mworker.c
src/proxy.c
src/resolvers.c
src/server.c
src/server_state.c
src/ssl_ckch.c
src/stats-proxy.c
src/stats.c