CDN77 Traces Slow Edge Servers to a Linux Kernel Memory Bug
CDN77 found that a memory bug in the Linux kernel was throttling network connections on its edge servers, leading to degraded performance for customers, according to a report on Hackaday.
Symptoms appeared on edge servers
Customers of CDN77 began complaining about degraded performance on their edge servers. According to the report, the slowdowns lasted a few hours at a time before the problem resolved itself and normal speeds returned.
The company's edge network consists of many high-memory CPU servers spread across different locations, which run nginx and serve content such as videos to end users as the last step in a chain of proxies.
Ruling out the usual causes
Early checks eliminated the usual suspects. Nginx appeared to run as expected, with no delays in syscalls or other anomalies. CPU utilisation returned to normal, and no memory pressure was reported. Because the issue appeared across geographically dispersed servers, internet service provider problems were also ruled out.
The behaviour was odd in one respect: only nginx was affected, and the problem appeared only on HTTP cache misses.
Kernel TCP stack throttling connections
Investigation eventually turned to the Linux kernel's TCP stack, where a pattern emerged. The kernel was clamping the TCP window to a quarter of its maximum, a feature normally designed to prevent network congestion. The kernel appeared to sense significant pressure on the TCP stack and began throttling connections, even though there was no overall system memory pressure.
According to the report, CDN77 found that the TCP memory pressure check does not depend solely on system memory utilisation but also on cgroup memory utilisation. Systemd had launched the services in their own cgroup, which adds separate memory accounting features.
Open questions
- Has the memory bug been fully patched in the Linux kernel?
- Which kernel versions are affected by the bug?