Nginx upstream keepalive connections improve load balancer performance
infoperformanceUpdated Sep 1, 2025(via Exa)
How to detect:
Without keepalive connections to upstream Express servers, Nginx creates new TCP connections for each request, adding latency and overhead. Connection establishment overhead accumulates under high request rates.
Recommended action:
Configure Nginx upstream block with keepalive 32 to maintain persistent connections to backend servers. Set proxy_http_version 1.1 and appropriate proxy_set_header directives for Connection upgrade, Host, X-Real-IP, X-Forwarded-For, and X-Forwarded-Proto headers. Use proxy_cache_bypass for upgrade requests.