A Linux Memory-Pressure Flag Throttled Every nginx Socket at CDN77 for Five Hours
Software / news
A Linux Memory-Pressure Flag Throttled Every nginx Socket at CDN77 for Five Hours
The cause was a cgroup reclaim heuristic, not a lack of free RAM, and the only visible trace is a counter that arrived in Linux 6.19.
Download speeds on some CDN77 edge servers fell, stayed low for hours and then recovered with no error codes, and the cause was a memory-pressure flag in the Linux kernel that throttles TCP. Daniel Sedlak, a Performance Engineer at CDN77, described the investigation on Nov. 25.
The slowdown hit only HTTP cache misses and only nginx. A curl test on the same server stayed fast, which ruled out the network path and left the process itself as the suspect.
How the throttle works
The kernel's TCP memory-pressure check also looks at the socket's cgroup. systemd had put nginx in a cgroup with the memory controller loaded, so one pressure flag set on that cgroup applied to every socket nginx owned.
Sedlak's account of the trigger runs in four steps:
- Memory reclaim in the cgroup scans a window of about 2 MB, which is 512 pages of 4 KB, hardcoded in the kernel version he debugged.
- If reclaim frees less than about 40% of the scanned pages, the kernel sets the pressure flag.
tcp_adjust_rcv_ssthresh()then shrinks the receive window. The affectedrcv_ssthreshwas exactly four times the advertised MSS.- Each pressure event throttles every socket in the cgroup for at least one second.
The check measures reclaim efficiency over a small window. It does not look at how much free memory the machine has, so a cache-heavy server with plenty of free RAM can still trigger it.
| Quantity | Value in the CDN77 post |
|---|---|
| Reclaim window | about 2 MB (512 pages at 4 KB) |
| Pressure threshold | reclaim frees under about 40% |
| Throttle length per event | at least 1 second |
| Window clamp | 4 times advertised MSS |
| Observed slowdown | just before 3 a.m. to about 8 a.m. |
Why it was hard to find
The SNMP counters showed zero memory pressure, so the usual dashboards pointed away from the cause. The slowdown lasted about five hours: speed dropped just before 3 a.m., stayed flat, and returned to normal around 8 a.m. The post does not name a time zone or the kernel version Sedlak debugged.
CDN77's temporary workaround was to move the nginx processes into the root cgroup, where vmpressure() returns early. The post says that also removed unjustified throttling and out-of-memory kills. A proper fix is not released; the post says "we'll share a proper fix."
The counter that now exposes it
CDN77 reported the problem upstream and, with help from Linux memory subsystem maintainers, contributed a patch that adds a sock_throttled counter to memory.events. The post says it arrived in Linux 6.19. The kernel's cgroup v2 documentation defines the entry as "The number of times network sockets associated with this cgroup are throttled."
The mailing-list patch is dated Oct. 16, 2025 and is credited to Shakeel Butt, not to Sedlak. It changes 5 files with 14 insertions and 1 deletion. Its commit message lists three throttling actions: clamping the transmit window, failing to expand buffers, and pruning the out-of-order receive queue. It carries Acked-by from Roman Gushchin, Reviewed-by from Kuniyuki Iwashima and Reviewed-by from Sedlak, and its commit message contains no benchmark data.
Linux itself ran in other recent coverage: Unkernel boots Linux 7.3.4 on Node, and Nvdriver targets the same kernel.
What to check on your own servers
On a kernel with the counter, read memory.events for the cgroup that holds your web server and watch whether sock_throttled climbs during a slowdown. The kernel documentation notes that the file is hierarchical and points to memory.events.local for per-cgroup events. On older kernels, the only confirmed mitigation is the root-cgroup move, which also takes nginx out of any memory limit that cgroup enforced.
CDN77's post links no kernel commit and gives no fix date, so the next thing to look for is the follow-up it promises.
Sources
More in Software
- 01Touch ID for sudo on macOS: Four Steps of Setup and Two Places It Stops WorkingA Nov. 30 post walks through sudo_local on macOS Sonoma and later. Its readers added the tmux fix, and one warns that a passwordless gdb rule is root.
- 02Rust 1.100 Stabilises the Allocator Trait for Vec and Box, With More to ComeThe Nov. 12 release lets library authors hand a custom allocator to two collection types. A community walkthrough shows what that looks like in practice.
- 03Roc 0.1.0 Ships After Eight Years, Built on a 487-Day Rewrite From Rust to ZigThe release notes say only "Roc version 0.1.0." The numbers are in Richard Feldman's two blog posts, and several of them cut against the rewrite.
- 04Superpowers, at 330,000 Stars, Retunes Brainstorming a Third TimeIssue #2530 says the v7 questions waste tokens, and the fix in draft pull request #2756 was written by Claude Fable 5.2.