]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: lb/chash: use a read lock in chash_get_server_hash()
authorWilly Tarreau <w@1wt.eu>
Sat, 17 Oct 2020 18:15:49 +0000 (20:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 17 Oct 2020 18:15:49 +0000 (20:15 +0200)
commit4b6e3c284a98cb2e6b4758a418066bfce5b9cd05
tree9fd41e79f290ef3ae436c6491b052591de95c4eb
parentf76a21f78c2066f74fb04875006e08bc7a9413db
MINOR: lb/chash: use a read lock in chash_get_server_hash()

When using a low hash-balance-factor value, it's possible to loop
many times trying to find the best server. Figures in the order of
100-300 times were observed for 1000 servers with a factor of 101
(which seems a bit excessive for such a large farm). Given that
there's nothing in that function that prevents multiple threads
from working in parallel, let's switch to a read lock. Tests on
8 threads show roughly a 2% performance increase with this.
src/lb_chash.c