<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje" -->

---
title: Uncovering Hidden TCP Throttling in the Linux Kernel
description: Intermittent nginx download slowdowns on CDN77 edge servers came from cgroup memory pressure throttling every TCP socket in the service's cgroup. Using...
canonical: https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Uncovering Hidden TCP Throttling in the Linux Kernel | daily.dev
og:description: Intermittent nginx download slowdowns on CDN77 edge servers came from cgroup memory pressure throttling every TCP socket in the service's cgroup. Using...
og:url: https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje
og:image: https://api.daily.dev/og/posts/PpABKwJjE.png
og:image:alt: Uncovering Hidden TCP Throttling in the Linux Kernel
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Uncovering Hidden TCP Throttling in the Linux Kernel

**[Hacker News](https://daily.dev/sources/hn)** · 8 min read · 0 upvotes · 0 comments

## Summary

Intermittent nginx download slowdowns on CDN77 edge servers came from cgroup memory pressure throttling every TCP socket in the service's cgroup. Using bpftrace on tcp_rcv_established, the team found rcv_ssthresh pinned at four times the advertised MSS. The kernel flags pressure when reclaim frees under about 40% of a 2MB scan window, ignoring how much RAM is free. Every socket in the cgroup is then throttled for at least a second. Moving nginx to the root cgroup avoided it. Linux 6.19 adds a sock_throttled counter in memory.events.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.cdn77.com/blog/debugging-nginx-linux-contribution>

## Questions this post answers

### Why is nginx download throughput collapsing on a Linux server with plenty of free RAM, with no TCP memory pressure in nstat?

The kernel's TCP memory pressure check also consults the socket's cgroup. When reclaim frees under roughly 40% of pages in a 2MB scan window, the memcg flags socket pressure for one second, shrinking every socket's receive window. Free RAM is not part of the formula, so cache-heavy servers trigger it constantly while SNMP counters stay at zero.

_Engineers chasing kernel-level network slowdowns follow write-ups like this on daily.dev._

### How can I detect that cgroup memory pressure is throttling my TCP sockets on Linux?

Since Linux 6.19, memory.events in the cgroup directory includes a sock_throttled counter that counts sockets throttled by this mechanism. Before that there was no counter. One diagnostic is tracing tcp_rcv_established with bpftrace and checking whether rcv_ssthresh equals four times the advertised MSS.

_Developers debugging Linux networking regressions can keep up with kernel changes like this on daily.dev._

### Does moving a systemd service to the root cgroup avoid vmpressure socket throttling?

Yes. The vmpressure() function returns immediately for the root cgroup, so no socket pressure is set from reclaim shortfalls there. CDN77 moved its nginx processes into the root cgroup as a temporary fix. It also removed any risk of unjustified throttling, since no out-of-memory kills were involved.

_Teams tuning nginx and systemd in production use daily.dev to learn from others' postmortems._

## Community take

How the wider developer community reacted, aggregated from 2 discussions and 39 comments across lobsters, hackernews (as of 2026-11-30).

**TL;DR:** Developers praised the write-up as a well-researched deep dive, while a side debate erupted over whether Linux's dirty-page/memory-pressure defaults are fundamentally mismatched for modern RAM sizes, plus some grumbling about AI-generated kernel patches and content.

**Sentiment:** 45% positive · 40% mixed · 15% skeptical

**The case for**

- Many called the debugging write-up exceptionally clear and valuable for learning real-world kernel networking troubleshooting.
- Some pointed to a practical workaround (cgroup.memory=nosocket boot parameter) for avoiding the throttling.
- Commenters appreciated pointers to further resources (Brendan Gregg's books) for learning bpftrace/eBPF techniques.

**The pushback**

- Several argued the memory-pressure detection logic (40% reclaim ratio over a fixed small window, ignoring free RAM) is nonsensical and shouldn't count as 'pressure'.
- Some noted the cgroup memory controller has many non-obvious traps, like counting filesystem caches and tmpfs against limits, causing confusing performance regressions.
- A tangent criticized that the default dirty-page ratio is poorly suited to large-RAM machines and causes long stalls during writeback.
- Concern was raised that LLM-generated patches are now flooding kernel projects, forcing maintainers to remove useful TODO comments.

**By community**

- lobsters (positive): Minimal discussion, limited to brief praise for the writing.
- hackernews (mixed): Praise for the investigative write-up coexists with a heated tangent on dirty-page defaults and cgroup memory-pressure design, plus grumbling about AI's effect on open source.

**Hottest debate:** Whether the dirty-page ratio and the 40%-reclaim memory-pressure heuristic are badly broken defaults versus necessary safeguards for multi-tenant systems.

**Open questions**

- Why does cgroup memory pressure get flagged via a fixed scan-window ratio instead of accounting for actual free memory?
- Should memory pressure be treated as a simple boolean rather than a nuanced signal?

**Highlights**

> > Memory reclaim reports how many pages it scanned and how many it managed to free per cgroup. Once roughly two megabytes' worth of pages have been scanned, the kernel turns that into a ratio. If it freed less than about 40% of what it walked, that counts as memory pressure, and every socket in the cgroup gets throttled for that one second. What's NOT in the formula is how much free memory the machine has. Maybe I'm missing something, but can someone explain why memory pressure is detected like this in the first place? The article goes on to say that there was a TODO comment in the source to scale the scanning window proportional to the memory size, but why is memory pressure even measured like this without considering the free memory at all? Am I missing something or does that indeed make no sense?
> — [basilikum on hackernews · 1 comments](https://news.ycombinator.com/item?id=50703098)

> The volume of the writeout in itself would not be a problem if it weren't that the dirty page table is locked until writeout completes. That means that new page allocations are stalled while writeout is in progress. And you're right, the default dirty page ratio is way too high, especially in the much-ram-meets-spinning-rust scenario. I have had rsync backups stall for over a minute while the archive server digests its dirty page buffer, only to have the server then stop writing for long enough to allow the disks to go back to standby mode. It would take major engineering effort in the VFS layer to avoid locking the page table during writeout, but that's what a proper solution would look like in my eyes.
> — [tremon on hackernews](https://news.ycombinator.com/item?id=50702522)

> > There has been a steady stream of patches that have been submitted by newcomers to core mm 'fixing' this TODO, with all but the original having very likely been generated by LLMs. > It appears that TODOs to LLMs are like red rags to a bull. So... big open source projects are now forced to remove important TODOs from their code, because of vibe coders spamming patches for them? Every day, I discover a new way in which AI is killing open source.
> — [bakugo on hackernews · 1 comments](https://news.ycombinator.com/item?id=50706853)

> cgroup memory controller in general is full of traps. For example, it does also count filesystem caches into memory usage, which means just using it as limit against application leaks can get into bad behavior, especially if app relies on that cached file access, any leak will just cause that performance to get worse and worse far before it leaks to the level causing app to be killed. IIRC tmpfs is also charged to the cgroup that uses it. It makes sense from memory system perspective (else there would be a ways for cgroup to leak memory usage) but it also leads to many unintuitive debug sessions, and under-utilization of free RAM for caching
> — [InsidiousWombat on hackernews](https://news.ycombinator.com/item?id=50707360)

> I think the workaround for this at the moment is the boot parameter:    cgroup.memory=nosocket If you're not bothered about socket memory counting towards the cgroup's limit (it's usually negligible).
> — [rid on hackernews](https://news.ycombinator.com/item?id=50702504)

**Source threads**

- [lobsters](https://lobste.rs/s/5tvkbt/uncovering_hidden_tcp_throttling_linux) · 16 points · 1 comments
- [hackernews](https://news.ycombinator.com/item?id=50699391) · 280 points · 38 comments

## Similar posts on daily.dev

- [Meta Has A New Linux Optimization To Avoid Throttling TCP Throughput Unnecessarily](https://daily.dev/posts/meta-has-a-new-linux-optimization-to-avoid-throttling-tcp-throughput-unnecessarily-cg7lwriei) · Phoronix · 0 upvotes · 0 comments
- [How Google Traced GKE API Timeouts to a Linux Kernel TCP Bug](https://daily.dev/posts/how-google-traced-gke-api-timeouts-to-a-linux-kernel-tcp-bug-isbcjux5v) · InfoQ · 0 upvotes · 0 comments
- [When "idle" isn't idle: how a Linux kernel optimization became a QUIC bug](https://daily.dev/posts/when-idle-isn-t-idle-how-a-linux-kernel-optimization-became-a-quic-bug-y5u5jcdr8) · Cloudflare · 48 upvotes · 0 comments
- [Does moving a GPU server's request loop into the kernel save CPU?](https://daily.dev/posts/does-moving-a-gpu-server-s-request-loop-into-the-kernel-save-cpu--vxjorhs2v) · eunomia eBPF Blog · 0 upvotes · 0 comments

---

Tags: [#linux](https://daily.dev/tags/linux), [#nginx](https://daily.dev/tags/nginx)

[View this post on daily.dev](https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Uncovering Hidden TCP Throttling in the Linux Kernel","url":"https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje"},"datePublished":"2026-11-30T16:33:55.576Z","dateModified":"2026-11-30T22:56:08.148Z","description":"Intermittent nginx download slowdowns on CDN77 edge servers came from cgroup memory pressure throttling every TCP socket in the service's cgroup. Using...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5c300d8d61ffdbbcc6fa9a142d8f58a7?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5c300d8d61ffdbbcc6fa9a142d8f58a7?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"linux,nginx","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"Uncovering Hidden TCP Throttling in the Linux Kernel"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/uncovering-hidden-tcp-throttling-in-the-linux-kernel-ppabkwjje#faq","mainEntity":[{"@type":"Question","name":"Why is nginx download throughput collapsing on a Linux server with plenty of free RAM, with no TCP memory pressure in nstat?","acceptedAnswer":{"@type":"Answer","text":"The kernel's TCP memory pressure check also consults the socket's cgroup. When reclaim frees under roughly 40% of pages in a 2MB scan window, the memcg flags socket pressure for one second, shrinking every socket's receive window. Free RAM is not part of the formula, so cache-heavy servers trigger it constantly while SNMP counters stay at zero. Engineers chasing kernel-level network slowdowns follow write-ups like this on daily.dev."}},{"@type":"Question","name":"How can I detect that cgroup memory pressure is throttling my TCP sockets on Linux?","acceptedAnswer":{"@type":"Answer","text":"Since Linux 6.19, memory.events in the cgroup directory includes a sock_throttled counter that counts sockets throttled by this mechanism. Before that there was no counter. One diagnostic is tracing tcp_rcv_established with bpftrace and checking whether rcv_ssthresh equals four times the advertised MSS. Developers debugging Linux networking regressions can keep up with kernel changes like this on daily.dev."}},{"@type":"Question","name":"Does moving a systemd service to the root cgroup avoid vmpressure socket throttling?","acceptedAnswer":{"@type":"Answer","text":"Yes. The vmpressure() function returns immediately for the root cgroup, so no socket pressure is set from reclaim shortfalls there. CDN77 moved its nginx processes into the root cgroup as a temporary fix. It also removed any risk of unjustified throttling, since no out-of-memory kills were involved. Teams tuning nginx and systemd in production use daily.dev to learn from others' postmortems."}}]}
```

