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.

(cherry picked from commit e99c43907c2365e74a0be0198b08434f68d5b80a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit b950734a393419c9558edf8e11a25cf39e75973f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 5d1ec1bab76798d738f509c36c7eac838f5e5445)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
2 files changed