mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MEDIUM: checks: Stop scheduling healthchecks during stopping stage
When the process is stopping, the health-checks are suspended. However the task is still periodically woken up for nothing. If there is a huge number of health-checks and if they are woken up in same time, it may lead to a noticeable CPU consumption for no reason. To avoid this extra CPU cost, we stop to schedule the health-check tasks when the proxy is disabled or stopped. This patch should partially solve the issue #2145.
This commit is contained in:
parent
8a46f98615
commit
8bca3cc8c7
@ -1327,8 +1327,13 @@ struct task *process_chk_conn(struct task *t, void *context, unsigned int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
reschedule:
|
reschedule:
|
||||||
while (tick_is_expired(t->expire, now_ms))
|
if (proxy->flags & (PR_FL_DISABLED|PR_FL_STOPPED))
|
||||||
t->expire = tick_add(t->expire, MS_TO_TICKS(check->inter));
|
t->expire = TICK_ETERNITY;
|
||||||
|
else {
|
||||||
|
while (tick_is_expired(t->expire, now_ms))
|
||||||
|
t->expire = tick_add(t->expire, MS_TO_TICKS(check->inter));
|
||||||
|
}
|
||||||
|
|
||||||
out_unlock:
|
out_unlock:
|
||||||
if (check->server)
|
if (check->server)
|
||||||
HA_SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
|
HA_SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user