]> git.ipfire.org Git - thirdparty/haproxy.git/commit
OPTIM: cfgparse: speed up duplicate server detection
authorWilly Tarreau <w@1wt.eu>
Fri, 20 Sep 2024 15:12:04 +0000 (17:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 20 Sep 2024 15:14:50 +0000 (17:14 +0200)
commit029d75df1e4d3049df77fe5cf9825bcab7f00aa4
tree525a82cd0349e8e0a19401f4495b2508f2d25939
parentccd1ecba1daa0cfc3403b6497f8606921400bc49
OPTIM: cfgparse: speed up duplicate server detection

Surprisingly, the duplicate server name detection has never made use
of the names tree, so lookups were still in O(N^2). It took 1 second
to validate 50k servers spread into 25 backends at 2k per backend.

By simply using the tree (and since the current server already is in
the tree), we just have to walk using ebpt_prev_dup to visit previous
servers with the same name. We can then detect which ones conflict
without having an ID set and error. The config check time is now 1/4
of the previous one for 2k servers per backend, and more importantly
it will make it simpler to check for any duplicates later.
src/cfgparse.c