Welcome! Log In Create A New Profile

Advanced

[PATCH] add reload_delay directive

Peng Fang
June 19, 2017 11:10AM
exporting patch:
# HG changeset patch
# User RocFang <fangpeng1986@gmail.com>
# Date 1497882783 0
# Node ID 8b9e416ef7f9f8e7f96eaa53b479062683464481
# Parent a39bc74873faf9e5bea616561b43f6ecc55229f9
Introduced reload_delay.

Previously, the master process will sleep 100ms before sending a
SHUTDOWN signal to old worker processes when reload. This patch
make the sleep time configurable, because in some scenarios, the
new workers may spend more than 100ms to get ready. For example,
the init_prcess hook of some 3rd modules may be time-consuming.

diff -r a39bc74873fa -r 8b9e416ef7f9 src/core/nginx.c
--- a/src/core/nginx.c Mon Jun 19 14:25:42 2017 +0300
+++ b/src/core/nginx.c Mon Jun 19 14:33:03 2017 +0000
@@ -152,6 +152,13 @@
0,
NULL },

+ { ngx_string("reload_delay"),
+ NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
+ ngx_conf_set_msec_slot,
+ 0,
+ offsetof(ngx_core_conf_t, reload_delay),
+ NULL },
+
ngx_null_command
};

@@ -1022,6 +1029,7 @@
ccf->master = NGX_CONF_UNSET;
ccf->timer_resolution = NGX_CONF_UNSET_MSEC;
ccf->shutdown_timeout = NGX_CONF_UNSET_MSEC;
+ ccf->reload_delay = NGX_CONF_UNSET_MSEC;

ccf->worker_processes = NGX_CONF_UNSET;
ccf->debug_points = NGX_CONF_UNSET;
@@ -1051,6 +1059,7 @@
ngx_conf_init_value(ccf->master, 1);
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
ngx_conf_init_msec_value(ccf->shutdown_timeout, 0);
+ ngx_conf_init_msec_value(ccf->reload_delay, 100);

ngx_conf_init_value(ccf->worker_processes, 1);
ngx_conf_init_value(ccf->debug_points, 0);
diff -r a39bc74873fa -r 8b9e416ef7f9 src/core/ngx_cycle.h
--- a/src/core/ngx_cycle.h Mon Jun 19 14:25:42 2017 +0300
+++ b/src/core/ngx_cycle.h Mon Jun 19 14:33:03 2017 +0000
@@ -89,6 +89,7 @@

ngx_msec_t timer_resolution;
ngx_msec_t shutdown_timeout;
+ ngx_msec_t reload_delay;

ngx_int_t worker_processes;
ngx_int_t debug_points;
diff -r a39bc74873fa -r 8b9e416ef7f9 src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c Mon Jun 19 14:25:42 2017 +0300
+++ b/src/os/unix/ngx_process_cycle.c Mon Jun 19 14:33:03 2017 +0000
@@ -245,7 +245,7 @@
ngx_start_cache_manager_processes(cycle, 1);

/* allow new processes to start */
- ngx_msleep(100);
+ ngx_msleep(ccf->reload_delay);

live = 1;
ngx_signal_worker_processes(cycle,
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] add reload_delay directive

Peng Fang 339 June 19, 2017 11:10AM

Re: [PATCH] add reload_delay directive

Maxim Dounin 183 June 19, 2017 11:30AM

Re: [PATCH] add reload_delay directive

Peng Fang 174 June 19, 2017 11:40AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 218
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready