]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: haload: split the rate exactly across threads
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 21 Aug 2026 16:26:38 +0000 (18:26 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 24 Aug 2026 17:16:05 +0000 (19:16 +0200)
commit98093c5105fdc7b04c7ceb3348f010fa52ac1986
tree8a45a7bf0669f9e1f8a1abfed39b18401d41cd3a
parent297321e3eeb509b4afc458bd810d30e225446ba7
BUG/MINOR: haload: split the rate exactly across threads

hld_usr_schedule() and hld_rate_task() gave every thread ceil(rate /
arg_thrd), so a low rate on a machine with many threads was quietly
served several times over (e.g. rate=1 on 200 threads gave ~200 req/s
instead of 1). Use the same exact split already used elsewhere in
haload (thread <tid> gets (rate + tid) / arg_thrd): most threads then
get 0 and only <rate> of them get 1, so the total always matches
<rate> regardless of the thread count.

A thread with no budget now just checks back in 1s instead of being
bumped to 1 by the old max ? max : 1 fallback.
src/haload.c