]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stick-table: switch to rdlock in stktable_lookup() and lookup_key()
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Oct 2022 13:42:54 +0000 (15:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Oct 2022 12:19:05 +0000 (14:19 +0200)
commita7d6a1396ec9608e6b9d48093bc7996cafbd61b9
treeed5cf78ffd5867099663960ef105196c7c3065e9
parent175aa0623284f9ee247bd301a4bbb441013dcf9a
MEDIUM: stick-table: switch to rdlock in stktable_lookup() and lookup_key()

These functions do not modify anything in the the table except the refcount
on success. Let's just lock the table for shared accesses and make use of
atomic ops to update the refcount. This brings a nice gain from 425k to
455k under 48 threads (7%), but some contention remains on the exclusive
locks in other parts.

Note that the refcount continues to be updated under the lock because it's
not yet certain whether there are races between it and some of the exclusive
lock on the table. The difference is marginal and we prefer to stay on the
safe side for now.
src/stick_table.c