]> git.ipfire.org Git - thirdparty/haproxy.git/commit
OPTIM: sink: consider threads' current load when rebalancing applets
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 22 Jul 2024 15:52:18 +0000 (17:52 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 24 Jul 2024 15:59:18 +0000 (17:59 +0200)
commit2513bd257f2db7fc48fc50f7227a8fa13aeb2680
treefcfce9a63a976a4e3896c1b49f897d6ab7399a68
parent237849c911f6d7772c1f5eb4e91644f9b32196bc
OPTIM: sink: consider threads' current load when rebalancing applets

In c454296f0 ("OPTIM: sink: balance applets accross threads"), we already
made sure to balance applets accross threads by picking a random thread
to spawn the new applet.

Also, thanks to the previous commit, we also have the ability to destroy
the applet when a certain amount of messages were processed to help
distribute the load during runtime.

Let's improve that by trying up to 3 different threads in the hope to pick
a non-overloaded one in the best scenario, and the least over loaded one
in the worst case. This should help to better distribute the load over
multiple threads when high loads are expected.

Logic was greatly inspired from thread migration logic used by server
health checks, but it was simpliflied for sink's use case.
src/sink.c