The CHK_ST_SLEEPING state was introduced by commit
d114f4a68 ("MEDIUM:
checks: spread the checks load over random threads") to indicate that
a check was not currently bound to a thread and that it could easily
be migrated to any other thread. However it did not start the checks
in this state, meaning that they were not redispatchable on startup.
Sometimes under heavy load (e.g. when using SSL checks with OpenSSL 3.0)
the cost of setting up new connections is so high that some threads may
experience connection timeouts on startup. In this case it's better if
they can transfer their excess load to other idle threads. By just
marking the check as sleeping upon startup, we can do this and
significantly reduce the number of failed initial checks.
#define CHK_ST_OUT_ALLOC 0x0080 /* check blocked waiting for output buffer allocation */
#define CHK_ST_CLOSE_CONN 0x0100 /* check is waiting that the connection gets closed */
#define CHK_ST_PURGE 0x0200 /* check must be freed */
-#define CHK_ST_SLEEPING 0x0400 /* check was sleeping */
+#define CHK_ST_SLEEPING 0x0400 /* check was sleeping, i.e. not currently bound to a thread */
#define CHK_ST_FASTINTER 0x0800 /* force fastinter check */
/* check status */
ret |= ERR_ALERT | ERR_ABORT;
goto out;
}
- srv->check.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED;
+ srv->check.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_SLEEPING;
srv_take(srv);
/* Only increment maxsock for servers from the configuration. Dynamic
if (!srv->agent.inter)
srv->agent.inter = srv->check.inter;
- srv->agent.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_AGENT;
+ srv->agent.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_SLEEPING | CHK_ST_AGENT;
srv_take(srv);
/* Only increment maxsock for servers from the configuration. Dynamic