MEDIUM: hlua: Dynamic list of frontend/backend in Lua
authorThierry Fournier <tfournier@arpalert.org>
Fri, 30 Sep 2022 09:03:38 +0000 (11:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:58:16 +0000 (08:58 +0200)
commit467913c84ecd1274cbb313f4e507160049cce14c
tree2a4d46d46f6ace872df4c80ef750204afb123da6
parent599f2311a8893c7e19fef689ce30854720a9d0fe
MEDIUM: hlua: Dynamic list of frontend/backend in Lua

When HAproxy is loaded with a lot of frontends/backends (tested with 300k),
it is slow to start and it uses a lot of memory just for indexing backends
in the lua tables.

This patch uses the internal frontend/backend index of HAProxy in place of
lua table.

HAProxy startup is now quicker as each frontend/backend object is created
on demand and not at init.
This has to come with some cost: the execution of Lua will be a little bit
slower.
include/haproxy/hlua-t.h
include/haproxy/hlua_fcn.h
src/hlua.c
src/hlua_fcn.c