When scaling TCP proxies to 100,000 concurrent connections, engineers often hit unexpected ceilings. This case study dissects why Nginx stalls at 40,000 connections, examining kernel parameters, file descriptor limits, and Nginx worker settings. The author walks through systematic diagnostics, revealing that common defaults like somaxconn and net.core.rmem_max are frequent culprits. Practical tuning advice includes adjusting backlog queues, increasing worker_connections, and optimizing epoll event handling. The post emphasizes measuring actual limits rather than relying on theoretical maximums. For teams building high-concurrency gateways, these findings highlight the importance of holistic system tuning beyond just Nginx configuration. The analysis is grounded in real-world testing, making it a valuable reference for infrastructure engineers facing similar scaling challenges.
A practical analysis of Nginx TCP proxy bottlenecks, showing how kernel and config limits cap throughput at 40K connections.