NGINX

Upstream Connection Pool Saturation Blocks NGINX Workers

critical
Resource ContentionUpdated Jul 11, 2025

When NGINX proxies to backends (PHP-FPM, FastCGI, uwsgi) without proper connection limits, a single site can exhaust the proxy connection pool, blocking other sites on shared infrastructure. Default mod_proxy behavior allows each child process to open max connections equal to ThreadsPerChild × ServerLimit.

How to detect:

Alert when nginx_upstream_peers_active approaches nginx_upstream_peers_max_backend across multiple upstreams, or when nginx_upstream_peers_unavail increases. Also monitor nginx_stream_upstream_peers_fails and nginx_upstream_peers_fails for connection failures. Correlate with per-site nginx_server_zone_processing to identify which site is saturating pools.

Recommended action:

Configure per-upstream connection limits matching backend capacity (e.g., ProxySet max=12 matching PHP-FPM pm.max_children=12). Set acquire timeout (ProxySet acquire=1000ms) to fail fast rather than block indefinitely. For shared hosting, implement per-site upstream blocks with individual max_conn settings, or use vhost-limiting modules. Monitor nginx_upstream_peers_requested vs nginx_upstream_peers_active to validate limits.