in the context of seamless reload and busy polling, older processes will
create unecessary cpu conflicts; we can assume there is no need for busy
polling for old processes which are waiting to be terminated.

This patch is not a bug fix itself but might be a good stability
improvment when you are un the context of frequent seamless reloads with
a high "hard-stop-after" value; for that reasons I think this patch
should be backported in all 2.x versions.

Signed-off-by: William Dauchy <w.dau...@criteo.com>
---
 doc/configuration.txt | 3 +++
 src/proxy.c           | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/doc/configuration.txt b/doc/configuration.txt
index bfc8b903..c8e13192 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -1475,6 +1475,9 @@ busy-polling
   default. If it has been enabled, it may still be forcibly disabled by
   prefixing it with the "no" keyword. It is ignored by the "select" and
   "poll" pollers.
+  This option is automatically disabled on old processes in the context of
+  seamless reload; it avoids too much cpu conflicts when multiple processes
+  stay around for some time waiting for the end of their current connections.
 
 max-spread-checks <delay in milliseconds>
   By default, haproxy tries to spread the start of health checks across the
diff --git a/src/proxy.c b/src/proxy.c
index a5570daf..9448d1a3 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1116,6 +1116,8 @@ void soft_stop(void)
        struct task *task;
 
        stopping = 1;
+       /* disable busy polling to avoid cpu eating for the new process */
+       global.tune.options &= ~GTUNE_BUSY_POLLING;
        if (tick_isset(global.hard_stop_after)) {
                task = task_new(MAX_THREADS_MASK);
                if (task) {
-- 
2.24.1


Reply via email to