MINOR: checks: maintain counters of active checks per thread
authorWilly Tarreau <w@1wt.eu>
Thu, 17 Aug 2023 14:25:28 +0000 (16:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 Sep 2023 06:26:06 +0000 (08:26 +0200)
commit00de9e08049dbb1749dded3a8d021875dd019678
tree8b8f641e4d81135429453f1ba903f42c8de03df0
parent3b7942a1c9d2dc4d91b8e8d7732cccef6642f99c
MINOR: checks: maintain counters of active checks per thread

Let's keep two check counters per thread:
  - one for "active" checks, i.e. checks that are no more sleeping
    and are assigned to the thread. These include sleeping and
    running checks ;

  - one for "running" checks, i.e. those which are currently
    executing on the thread.

By doing so, we'll be able to spread the health checks load a bit better
and refrain from sending too many at once per thread. The counters are
atomic since a migration increments the target thread's active counter.
These numbers are reported in "show activity", which allows to check
per thread and globally how many checks are currently pending and running
on the system.

Ideally, we should only consider checks in the process of establishing
a connection since that's really the expensive part (particularly with
OpenSSL 3.0). But the inner layers are really not suitable to doing
this. However knowing the number of active checks is already a good
enough hint.
include/haproxy/tinfo-t.h
src/activity.c
src/check.c