]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: pools: move the used counter over a few buckets
authorWilly Tarreau <w@1wt.eu>
Mon, 24 Jul 2023 14:12:18 +0000 (16:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Aug 2023 17:04:34 +0000 (19:04 +0200)
commit9e5eb586b18a0176a5f5c237b5fa27948accb798
tree9f86b6f69571d0249169f178f202e29dbd5a697c
parentcdb711e42b8f1d611645f2198aa95548817f3523
MEDIUM: pools: move the used counter over a few buckets

That's the same principle as for ->allocated. The small difference here
is that it's no longer possible to decrement ->used in batches when
releasing clusters from the cache to the shared cache, so the counter
has to be decremented for each of them. But as it provides less
contention and it's done only during forced eviction, it shouldn't be
a problem.

A function "pool_used()" was added to return the sum of the entries.
It's used by pool_alloc_nocache() and pool_free_nocache() which need
to count the number of used entries. It's not a problem since such
operations are done when picking/releasing objects to/from the OS,
but it is a reminder that the number of buckets should remain small.

With this change, an h2load test made of 5 * 160 conn * 40 streams on
80 threads raised from 812k RPS to 1.5M RPS.
include/haproxy/pool-t.h
include/haproxy/pool.h
src/pool.c