Why does one NGINX worker take all the load?
Oct 23, 2017Marek Majkowski

Summary
This post delves into the intricacies of load balancing in NGINX, specifically addressing the problem of uneven distribution of incoming connections across worker processes. It explains the different models for handling accept() calls, the Linux kernel's differing load balancing behaviors for blocking accept() vs. epoll-and-accept, and introduces SO_REUSEPORT as a solution for achieving more even load distribution. The post also highlights the critical trade-off between even load balancing and latency, demonstrating how SO_REUSEPORT can sometimes lead to degraded latency distributions under high load.
More from the Data Infrastructure & Analytics trail
- Introducing Cloudflare Basin: an open, serverless data platform, now generally available
- Introducing the Billable Usage API: programmatic cost visibility for Cloudflare
- Announcing the Monetization Gateway: charge for any resource behind Cloudflare via x402
- How we built Cloudflare's data platform and an AI agent on top of it
- Iran's Internet is partially restored, Cloudflare Radar data shows