🐢Edge Server Download Speeds Collapse for Hours Due to Hidden cgroup Memory Bug
Your memcg settings might be quietly throttling your sockets
TL;DR
A customer report of collapsing download speeds led engineers to a hidden cgroup memory controller behavior that shrinks socket buffers across an entire cgroup. Disabling the controller fixed it. If you run nginx under memory limits, check your cgroup setup before blaming the network.
Download speeds from an edge server kept collapsing for hours, then recovering on their own. The culprit turned out to be the cgroup memory controller, which is enabled by default on most distributions. It has an undocumented behavior: when a cgroup hits memory pressure, it sets a pressure flag that shrinks every socket buffer inside that cgroup. Throughput falls off a cliff, and nothing in your sysctl or nginx config will show it. If you run nginx or any proxy on a memory-limited container or VM, this is your problem to care about. The bug only surfaced on HTTP cache misses, which is exactly when nginx is reading from upstream and filling buffers. Healthy neighbor servers with identical configs were fine, so the usual suspects, ISP paths and tuning knobs, got ruled out quickly. Rebooting helped temporarily, which is the classic sign of something dynamic and self-healing. The diagnosis came down to rcv_ssthresh. Its value sat at exactly four times the advertised MSS, and the only code path writing it was tcp_adjust_rcv_ssthresh(). Disabling the cgroup memory controller made the problem disappear completely. The pressure flag is raised through vmpressure(), which returns immediately for the root cgroup, so the behavior only bites inside child cgroups.

Key Points
Download speeds collapsed for certain connections and stayed low for hours before recovering on their own, with no operator action required at any point during the incident.
Keep reading — it's free
Enter your email to keep reading — plus the best of AI & tech, daily. Free, forever.
Already a member? Sign in
Comments
Be the first to comment