comparison src/core/ngx_connection.h @ 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 4f6efabcb09b
children 257b51c37c5a
comparison
equal deleted inserted replaced
6219:808fd1f0b94b 6220:5e6142609e48
213 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle); 213 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
214 ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle); 214 ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
215 void ngx_configure_listening_sockets(ngx_cycle_t *cycle); 215 void ngx_configure_listening_sockets(ngx_cycle_t *cycle);
216 void ngx_close_listening_sockets(ngx_cycle_t *cycle); 216 void ngx_close_listening_sockets(ngx_cycle_t *cycle);
217 void ngx_close_connection(ngx_connection_t *c); 217 void ngx_close_connection(ngx_connection_t *c);
218 void ngx_close_idle_connections(ngx_cycle_t *cycle);
218 ngx_int_t ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s, 219 ngx_int_t ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
219 ngx_uint_t port); 220 ngx_uint_t port);
220 ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text); 221 ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text);
221 222
222 ngx_connection_t *ngx_get_connection(ngx_socket_t s, ngx_log_t *log); 223 ngx_connection_t *ngx_get_connection(ngx_socket_t s, ngx_log_t *log);