optimize: privileged agent: reduced the number of ngx_connection_t allocated inside the privileged worker to avoid excessive memory consumption when worker_connections is set very high.

Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
pull/266/merge
Datong Sun 8 years ago committed by Yichun Zhang (agentzh)
parent 79520a30f8
commit 6e74463f66

@ -41,7 +41,7 @@ index c51b7ff..3261f90 100644
ngx_msec_t timer_resolution; ngx_msec_t timer_resolution;
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 3ead164..2b3f8df 100644 index 7cee1c5..c4f70d6 100644
--- a/src/os/unix/ngx_process_cycle.c --- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c +++ b/src/os/unix/ngx_process_cycle.c
@@ -15,6 +15,8 @@ static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, @@ -15,6 +15,8 @@ static void ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n,
@ -149,7 +149,7 @@ index 3ead164..2b3f8df 100644
if (setgid(ccf->group) == -1) { if (setgid(ccf->group) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
"setgid(%d) failed", ccf->group); "setgid(%d) failed", ccf->group);
@@ -1144,6 +1184,44 @@ ngx_cache_manager_process_cycle(ngx_cycle_t *cycle, void *data) @@ -1144,6 +1184,47 @@ ngx_cache_manager_process_cycle(ngx_cycle_t *cycle, void *data)
static void static void
@ -166,6 +166,9 @@ index 3ead164..2b3f8df 100644
+ +
+ ngx_close_listening_sockets(cycle); + ngx_close_listening_sockets(cycle);
+ +
+ /* Set a moderate number of connections for a helper process. */
+ cycle->connection_n = 512;
+
+ ngx_worker_process_init(cycle, -1); + ngx_worker_process_init(cycle, -1);
+ +
+ ngx_use_accept_mutex = 0; + ngx_use_accept_mutex = 0;

Loading…
Cancel
Save