A server with hundreds of gigabytes of free RAM can throttle every NGINX download for hours because of a 2 MB calculation. That is what CDN77 found on its edge nodes: the kernel flagged memory pressure on NGINX's cgroup while memory was plentiful, and every socket in that cgroup shrank its receive window to four segments. On November 25, 2026 the company published the full debugging story, which ended with a patch in Linux.
A bug only NGINX could see
The symptoms were the kind that make you doubt everything. A customer reported slow downloads from an edge server, with no error codes and no way to reproduce it. In one case throughput dropped just before 3 a.m., stayed flat for five hours and recovered on its own around 8 a.m. It showed up in several regions, which ruled out a single ISP or path. The sysctl values (tcp_rmem, tcp_wmem, tcp_mem), the NGINX configuration and the kernel versions matched those of healthy neighbouring servers.
Two clues narrowed it down. It only happened on cache misses, when the edge has to pull content from the layer above. And a curl run on the same server at the same moment downloaded at full speed: only NGINX processes were slow. A reboot fixed it for a while.
From userspace to the kernel
The team first suspected NGINX itself: maybe it delayed its read calls or read too few bytes at a time. They used eBPF to trace entry and exit of the read and epoll syscalls, with arguments, return codes and durations. Nothing odd: NGINX read everything available until it got EAGAIN, as fast as it could.
Next came a bpftrace kprobe on tcp_rcv_established to dump fields of struct tcp_sock such as the receive window, rcv_ssthresh and the advertised MSS. That is where the pattern appeared: rcv_ssthresh was exactly four times the MSS. Only tcp_adjust_rcv_ssthresh() writes that value, and on this path it is only called when tcp_under_memory_pressure() returns true.
The puzzling part was that the SNMP counters said otherwise: TcpExtTCPMemoryPressures sat at zero.
The pressure no counter showed
The answer lies in how TCP checks for memory pressure. Besides the global flag, tcp_under_memory_pressure() also checks whether the socket's cgroup is under pressure, whenever the cgroup memory controller is loaded. On most distributions it is, by default: systemd puts each service in its own cgroup with that controller enabled, even if you never set memory.high or memory.max.
The full chain looks like this:
- Memory reclaim scans the cgroup's pages, and
vmpressure()works out, over a fixed window of 512 pages (2 MB with 4 KB pages), how many it managed to free. - If it frees less than roughly 40% of what it scans, that counts as pressure. The machine's free memory is not part of the formula: a cache server with a large page cache fails that test constantly.
- When the level rises above
low, the kernel marks the whole cgroup with socket pressure for at least one second. - While the mark is set, every socket in the cgroup lowers its
rcv_ssthreshand throughput collapses.
The flag is per cgroup, not per socket, so one poor reclaim result slows down every NGINX connection at once. The 2 MB window was a hardcoded constant, with a TODO in the kernel source asking for it to scale with machine size.
The workaround and the patch
vmpressure() returns immediately for the root cgroup. CDN77 used that as a stopgap and moved the NGINX processes into the root cgroup. The throttling stopped, and there were no out-of-memory kills either, which shows the throttling was not protecting anything on those machines.
The underlying problem was that there was no way to see it. With help from the memory subsystem maintainers, CDN77 contributed a counter: since Linux 6.19, memory.events includes sock_throttled, the number of times the cgroup's sockets have been throttled. The cgroup v2 documentation already lists it. On kernel 6.19 or later you can check it in the service's cgroup:
# Under systemd, each service gets a cgroup in system.slice
cat /sys/fs/cgroup/system.slice/nginx.service/memory.eventsIf sock_throttled keeps climbing while the machine has memory to spare, this is your problem. CDN77 says a proper fix will follow.
There is another documented route CDN77 did not take: the cgroup.memory=nosocket boot parameter, which disables socket memory accounting in the memory controller. It applies to every cgroup on the machine and needs a reboot, but leaves services where they are. Moving a service to the root cgroup, by contrast, also strips it of the memory limits and accounting systemd would otherwise give it.
What to take away
The most useful lesson is the method rather than the bug. CDN77 eliminated hypotheses with data, not with config reviews: when configurations are identical and behaviour is not, what is missing is a view of runtime state. Going from syscalls down to a single tcp_sock field with bpftrace is what turned "it is slow sometimes" into one line of kernel code.
The second lesson is that defaults are configuration too. Nobody at CDN77 had asked to limit NGINX's memory; systemd loading the controller was enough for a memory-pressure heuristic to kick in on servers with hundreds of gigabytes free. Any network-heavy, page-cache-heavy workload running under systemd (proxies, caches, object storage) has the same combination.
And the third: "only this process is affected" points at whatever that process has that others do not, and on modern Linux the cgroup is one of the first suspects.
What does not carry over
CDN77's scale makes the problem very visible, but the mechanism does not depend on it: any service with its own cgroup and inefficient reclaim can hit it. The workaround is what is specific. Pulling NGINX out of its service cgroup works on servers dedicated to a single workload; on a shared node or in Kubernetes, where per-cgroup memory limits are exactly what isolates workloads from each other, it is not an option.
Sources
- Uncovering Hidden TCP Throttling in the Linux Kernel, CDN77, November 25, 2026.
- Control Group v2: memory.events, Linux kernel documentation.
- Kernel parameters: cgroup.memory, Linux kernel documentation.
- Hacker News discussion.