MINOR: deinit: add a "quick-exit" option to bypass the deinit step
Once in a while we spot a bug in the deinit code that is complex, especially when it has to deal with incomplete initializations, and the ability to bypass this step has regularly been raised. In addition for fast-reloading setups it could theoretically save some time. Tests have shown that very large configs can barely save ~100-150ms by skipping the deinit step. However the ability not to crash if a bug is encountered can occasionally help. This patch adds an option to do exactly this. It's obviously not enabled by default and the documentation discourages from using it, but this might be useful in the future.
This commit is contained in:
parent
16d6c0cb09
commit
e98d385819
@ -3238,6 +3238,15 @@ anonkey <key>
|
||||
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".
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user