Mercurial > hg > nginx-quic
comparison src/core/ngx_connection.c @ 8042:b9071b875194
Core: added a warning about reusing connections.
Previously, reusing connections happened silently and was only
visible in monitoring systems. This was shown to be not very user-friendly,
and administrators often didn't realize there were too few connections
available to withstand the load, and configured timeouts (keepalive_timeout
and http2_idle_timeout) were effectively reduced to keep things running.
To provide at least some information about this, a warning is now logged
(at most once per second, to avoid flooding the logs).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 10 Aug 2020 18:52:59 +0300 |
parents | 9c038f5e0464 |
children | 5440ff4ac6fc |
comparison
equal
deleted
inserted
replaced
8041:45764bca69b0 | 8042:b9071b875194 |
---|---|
1295 ngx_drain_connections(ngx_cycle_t *cycle) | 1295 ngx_drain_connections(ngx_cycle_t *cycle) |
1296 { | 1296 { |
1297 ngx_uint_t i, n; | 1297 ngx_uint_t i, n; |
1298 ngx_queue_t *q; | 1298 ngx_queue_t *q; |
1299 ngx_connection_t *c; | 1299 ngx_connection_t *c; |
1300 | |
1301 if (cycle->reusable_connections_n == 0) { | |
1302 return; | |
1303 } | |
1304 | |
1305 if (cycle->connections_reuse_time != ngx_time()) { | |
1306 cycle->connections_reuse_time = ngx_time(); | |
1307 | |
1308 ngx_log_error(NGX_LOG_WARN, cycle->log, 0, | |
1309 "%ui worker_connections are not enough, " | |
1310 "reusing connections", | |
1311 cycle->connection_n); | |
1312 } | |
1300 | 1313 |
1301 n = ngx_max(ngx_min(32, cycle->reusable_connections_n / 8), 1); | 1314 n = ngx_max(ngx_min(32, cycle->reusable_connections_n / 8), 1); |
1302 | 1315 |
1303 for (i = 0; i < n; i++) { | 1316 for (i = 0; i < n; i++) { |
1304 if (ngx_queue_empty(&cycle->reusable_connections_queue)) { | 1317 if (ngx_queue_empty(&cycle->reusable_connections_queue)) { |