
Unbounded memory usage by TCP for receive buffers, and how we fixed it
5/25/2023
This post details the discovery and root cause analysis of unbounded memory usage in TCP receive buffers on Cloudflare's production network. It identifies a specific scenario where Linux kernel TCP sessions can ignore memory allocation limits, leading to excessive memory consumption and impacting overall server performance. The post provides a minimal reproducible example using Python scripts and analyzes kernel code paths (tcp_clamp_window) to pinpoint the issue. It also discusses the observed behavior in production traffic, including scenarios where the user-space process stops reading data.




