Skip to content

Commit

Permalink
optimize: privileged agent: reduced the number of ngx_connection_t al…
Browse files Browse the repository at this point in the history
…located 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>
  • Loading branch information
dndx authored and agentzh committed Jun 17, 2017
1 parent 79520a3 commit 6e74463
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions patches/nginx-1.11.2-privileged_agent_process.patch
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ index c51b7ff..3261f90 100644
ngx_msec_t timer_resolution;

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
+++ 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,
Expand Down Expand Up @@ -149,7 +149,7 @@ index 3ead164..2b3f8df 100644
if (setgid(ccf->group) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
"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
Expand All @@ -166,6 +166,9 @@ index 3ead164..2b3f8df 100644
+
+ 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_use_accept_mutex = 0;
Expand Down

0 comments on commit 6e74463

Please sign in to comment.