Diagnostic step 1
Measure outgoing connection count and TIME_WAIT with ss -s and ss -tanp during a controlled load test to reproduce and quantify limits.
Generated Oct 29, 2026, 9:46:59 AM
Measure outgoing connection count and TIME_WAIT with ss -s and ss -tanp during a controlled load test to reproduce and quantify limits.
Enable and configure keepalive reuse in Node.js HTTP clients (set agent.keepAlive = true and increase maxSockets) and in NGINX upstream (keepalive directive) to reduce new TCP handshakes.
Increase ephemeral port range: sudo sysctl -w net.ipv4.ip_local_port_range='20000 65000' and persist in /etc/sysctl.conf; monitor for improvement.
Tune TIME-WAIT behavior conservatively: consider enabling tcp_tw_reuse=1 (allow reuse for new outgoing connections) and reduce tcp_fin_timeout to 30–60s only after testing; do not enable tcp_tw_recycle on NATted servers.
If using many short client connections, consider introducing a local connection pool or sticky upstream micro-proxy to amortize sockets, or use HTTP/2 multiplexing where possible.