Optimizing TCP for high WAN throughput while preserving low latency
Jul 1, 2022Mike Freemon

Summary
This post details Cloudflare's efforts to optimize TCP for high WAN throughput while preserving low latency, a critical requirement for newer products like Magic WAN, WARP, Spectrum, and Gateway. It explains the trade-offs between minimizing latency spikes by limiting TCP receive window size and achieving high throughput over high-latency links. The post introduces Linux autotuning as a mechanism to dynamically adjust buffer sizes and receive windows based on RTT and application read rates, and proposes specific sysctl values (net.ipv4.tcp_rmem, net.ipv4.tcp_wmem, net.ipv4.tcp_adv_win_scale) to achieve a balance between throughput and latency for long fat networks and elephant flows.