2026-09-20 · 1 min read
Window Scaling flag in TCP
Throughput on a TCP connection is a function of how much data you can have in flight and how long an acknowledgement takes to come back. With window scaling hard coded to 0, the window caps at 65,535 bytes, which is the whole explanation for a 2.62 Mbps ceiling at a 200ms round trip.
Recently I've been working on networking applications in Rust. Part of that meant implementing a user space IP stack, meaning the TCP/IP logic runs in an application process instead of the OS kernel, so I could control and modify it directly.
Throughput on a TCP connection is not just a property of the link. It's a function of two things: how much data you're allowed to have in flight before waiting for an acknowledgement, and how long that acknowledgement takes to come back.
TCP's window size field is 16 bits on its own, capping the window at 65,535 bytes. Window scaling is a TCP option that multiplies that field by , where is the scale factor, up to a maximum of 14.
I had a strong internet connection, but throughput on the link was capped at around 2.62 Mbps.
The library I was using for the user space stack hard coded the window scaling factor to 0. With scaling off, the window stays at 65,535 bytes regardless of how fast or short the round trip is. My round trip time was about 200ms, and that cap is the entire explanation for my throughput ceiling.
With window scaling implemented properly, the maximum throughput per TCP connection is no longer capped by a fixed 65KB window. At , the effective window rises to just over 1 gigabyte, and at the same 200ms round trip time, the maximum throughput becomes:
Far past what a 1 Gbit link could ever carry.
Next post
Shear Locking: When a Coarse Mesh Gets a Bending Shaft Right by Accident
A finite-element model of a bending steel shaft lands within five percent of the exact answer, but only because two unrelated errors cancel out. Change the geometry and the same elements come out 60% off.
Read post 5 min