]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: pools: spread the allocated counter over a few buckets
authorWilly Tarreau <w@1wt.eu>
Mon, 24 Jul 2023 13:53:17 +0000 (15:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 12 Aug 2023 17:04:34 +0000 (19:04 +0200)
commitcdb711e42b8f1d611645f2198aa95548817f3523
tree9759f64b9dbffc47ca44f3c76a27b7dbfe5ed128
parent06885aaea72bc8b70c6faea5b3a81de1c8f4225a
MEDIUM: pools: spread the allocated counter over a few buckets

The ->used counter is one of the most stressed, and it heavily
depends on the ->allocated one, so let's first move ->allocated
to a few buckets.

A function "pool_allocated()" was added to return the sum of the entries.
It's important not to abuse it as it does iterate, so everywhere it's
possible to avoid it by keeping a local counter, it's better. Currently
it's used for limited pools which need to make sure they do not allocate
too many objects. That's an acceptable tradeoff to save CPU on large
machines at the expense of spending a little bit more on small ones which
normally are not under load.
include/haproxy/pool-t.h
include/haproxy/pool.h
src/pool.c