首页›科技›Hackaday›文章

Fixing a Memory Bug in Linux, for Faster Networking

Fenix Guthrie · 2026年12月6日 · 约 2 分钟读完

AI 摘要 AI 生成,可能有误

CDN77 traced intermittent customer-reported slowdowns on its edge servers to the Linux kernel's TCP stack clamping connection windows on HTTP cache misses. The root cause was that TCP memory pressure checks rely on cgroup memory utilization instead of total system memory, throttling connections when less than 40% of a cgroup's memory is reclaimable. The long-standing bug, noted in a 2013 TODO, was fixed in Linux 6.19, while users of older kernels can move the affected process to the root cgroup as a workaround.

核心要点

  • Intermittent slowdowns in CDN edge servers were traced to the Linux kernel TCP stack, not nginx, ISPs, or CPU/memory issues.
  • The kernel falsely detected TCP memory pressure based on cgroup memory utilization and throttled connections to a quarter of the maximum window.
  • If less than 40% of a cgroup's memory can be reclaimed, TCP connections are throttled regardless of free machine memory.
  • The bug, flagged in a 2013 TODO, is fixed in Linux 6.19; older systems can move the process to the root cgroup to avoid throttling.
  • The case illustrates how subtle kernel edge-case bugs can degrade complex, geographically distributed networks.

Content delivery networks are notoriously complex and finicky systems. So no one at CDN77 was terribly surprised when customers started complaining about degraded performance on their edge servers. For a few hours they would notice slower speeds, than, the bug would self-heal and normal speeds would return. But that simple complaint led down the rode to patching a bug in the Linux kernel.

In a sense, CDN77’s edge network consists of a large number of high-memory CPU servers geographically dispersed serving nginx with a bit of magic. These are used a the last point in a chain of proxies to serve content like videos to the end-user. The usual suspects could be eliminated early on in the process. The issue was geographically disperse, eliminating ISP issues. The servers were also identically configured. Even the CPU utilization returned normal, with no reported memory pressure.

What proved even stranger is that only nginx was effected by the bug, and it only appeared on HTTP cache misses. However, nginx appeared run as expected; no delays in syscalls or other anomalies. Finally, in the Linux kernel TCP stack, a pattern begun to emerge. The kernel was clamping the window to a quarter its maximum, a feature designed to prevent network congestion. The kernel thought there was significant pressure on the TCP stack and begun throttling connections, a strange behavior given no overall system memory pressure.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。