BUG/MEDIUM: spoe: Don't start new applet if there are enough idle ones
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 26 Apr 2023 13:56:59 +0000 (15:56 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 28 Apr 2023 06:51:34 +0000 (08:51 +0200)
commite99c43907c2365e74a0be0198b08434f68d5b80a
tree86987aba64d7afdad18760749714d8ca083b0865
parentd2f61de8c244e71f7194af53c03c98dcb3d6219a
BUG/MEDIUM: spoe: Don't start new applet if there are enough idle ones

It is possible to start too many applets on sporadic burst of events after
an inactivity period. It is due to the way we estimate if a new applet must
be created or not. It is based on a frequency counter. We compare the events
processing rate against the number of events currently processed (in
progress or waiting to be processed). But we should also take care of the
number of idle applets.

We already track the number of idle applets, but it is global and not
per-thread. Thus we now also track the number of idle applets per-thread. It
is not a big deal because this fills a hole in the spoe_agent structure.
Thanks to this counter, we can refrain applets creation if there is enough
idle applets to handle currently processed events.

This patch should be backported to every stable versions.
include/haproxy/spoe-t.h
src/flt_spoe.c