comparison src/http/modules/ngx_http_upstream_keepalive_module.c @ 6220:5e6142609e48

Core: idle connections now closed only once on exiting. Iterating through all connections takes a lot of CPU time, especially with large number of worker connections configured. As a result nginx processes used to consume CPU time during graceful shutdown. To mitigate this we now only do a full scan for idle connections when shutdown signal is received. Transitions of connections to idle ones are now expected to be avoided if the ngx_exiting flag is set. The upstream keepalive module was modified to follow this.
author Valentin Bartenev <vbart@nginx.com>
date Tue, 11 Aug 2015 16:28:55 +0300
parents 87d48f8793b6
children 78b4e10b4367
comparison
equal deleted inserted replaced
6219:808fd1f0b94b 6220:5e6142609e48
300 300
301 if (!u->keepalive) { 301 if (!u->keepalive) {
302 goto invalid; 302 goto invalid;
303 } 303 }
304 304
305 if (ngx_terminate || ngx_exiting) {
306 goto invalid;
307 }
308
305 if (ngx_handle_read_event(c->read, 0) != NGX_OK) { 309 if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
306 goto invalid; 310 goto invalid;
307 } 311 }
308 312
309 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, 313 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,