diff --git a/doc/configuration.txt b/doc/configuration.txt index cef8e7a8f..7ce7ae5e0 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -3238,6 +3238,15 @@ anonkey from the CLI command "set global-key". See also command line argument "-dC" in the management manual. +quick-exit + This speeds up the old process exit upon reload by skipping the releasing of + memory objects and listeners, since all of these are reclaimed by the + operating system at the process' death. The gains are only marginal (in the + order of a few hundred milliseconds for huge configurations at most). The + main target usage in fact is when a bug is spotted in the deinit() code, as + this allows to bypass it. It is better not to use this unless instructed to + do so by developers. + quiet Do not display any message during startup. It is equivalent to the command- line argument "-q". diff --git a/include/haproxy/global-t.h b/include/haproxy/global-t.h index 1c7f45b3a..0cdb361ae 100644 --- a/include/haproxy/global-t.h +++ b/include/haproxy/global-t.h @@ -77,6 +77,7 @@ #define GTUNE_IDLE_POOL_SHARED (1<<20) #define GTUNE_DISABLE_H2_WEBSOCKET (1<<21) #define GTUNE_DISABLE_ACTIVE_CLOSE (1<<22) +#define GTUNE_QUICK_EXIT (1<<23) /* SSL server verify mode */ enum { diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index 62de1013a..6cc4afe13 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -1221,6 +1221,11 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) env++; } } + else if (strcmp(args[0], "quick-exit") == 0) { + if (alertif_too_many_args(0, file, linenum, args, &err_code)) + goto out; + global.tune.options |= GTUNE_QUICK_EXIT; + } else if (strcmp(args[0], "strict-limits") == 0) { /* "no strict-limits" or "strict-limits" */ if (alertif_too_many_args(0, file, linenum, args, &err_code)) goto out; diff --git a/src/haproxy.c b/src/haproxy.c index 806497062..9f5e75f53 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2637,6 +2637,10 @@ void deinit(void) struct cfg_postparser *pprs, *pprsb; int cur_fd; + /* the user may want to skip this phase */ + if (global.tune.options & GTUNE_QUICK_EXIT) + return; + /* At this point the listeners state is weird: * - most listeners are still bound and referenced in their protocol * - some might be zombies that are not in their proto anymore, but