KUNST
SCHÖNHEIT & WELLNESS
HANDWERK
KULTUR & GESCHICHTE
UNTERHALTUNG
UMFELD
ESSEN & GETRÄNKE
REVERSE ENGINEERING
WISSENSCHAFTEN
SPORT
TECHNOLOGIE
WEARABLES

TCP: Sliding Window and Congestion Control
Everything below this promises nothing. The wire drops bits, the shared medium collides, the network reorders and discards without telling anyone. TCP is where somebody finally promises that the bytes you sent are the bytes that arrive, in order, exactly once — and it can only make that promise by assuming every layer beneath it has already failed.
The reliability part is straightforward and was in Cerf and Kahn's 1974 paper: number every byte, acknowledge what has arrived, retransmit what has not, and keep several segments in flight rather than waiting for each. The window has to be at least the bandwidth-delay product, because throughput is window divided by round-trip time, and a protocol that waits for each acknowledgement delivers the same throughput on a ten-gigabit link as on a hundred-megabit one.
The hard part arrived thirteen years later. In October 1986 the link between Lawrence Berkeley Laboratory and the Berkeley campus, four hundred metres apart, fell from 32 kilobits per second to 40 BITS per second. Nothing had broken. Every sender, finding packets lost, retransmitted; the retransmissions caused more loss; and the network spent its entire capacity carrying copies of data it had already carried. It is blueprint 7's collapse curve, on a whole internet.
Van Jacobson's answer in 1988 is one of the most consequential few hundred lines ever written. A sender must treat loss as a SIGNAL rather than as bad luck: probe upward until something drops, then halve. Nobody is told the capacity of anything. Every flow discovers it, continuously, and the additive-increase multiplicative-decrease pairing is the only simple rule that drives competing flows toward an equal share.
FULLY MEASURABLE. Capture a real transfer, plot the window, and find the sawtooth on your own machine.
Erfahren
4 hours
Anweisungen
1
1
Watch a real connection open
Watch a real connection open
Capture a transfer with `tcpdump` or Wireshark — a few megabytes fetched from anywhere far enough away to have a real round-trip time.
Find the three-way handshake at the start: SYN, SYN-ACK, ACK. Note that both directions announce an initial sequence number, and that each must be acknowledged — the handshake is three packets rather than two precisely because BOTH ends need their number confirmed.
Now measure the round-trip time from the SYN to the SYN-ACK, and write it down. Then find the point where bulk data starts and count how many segments are in flight before the first acknowledgement returns. Multiply your window by the segment size and divide by the round-trip time; compare that against the throughput you actually observed.
They will agree, and that is the whole performance model of TCP in one arithmetic check.
Benötigte Werkzeuge:
Desktop Computer
Stopwatch2
2
Find the sawtooth
Find the sawtooth
Most capture tools will plot the sequence number against time. Do that for a transfer long enough to hit a loss — a large download over a busy connection, or one you deliberately impair.
If you can, add impairment on purpose. On Linux, `tc qdisc add dev root netem loss 1% delay 50ms` makes a clean link behave like a distant one. Remove it afterwards.
Look at the slope of the sequence-number line. It climbs, then flattens abruptly, then resumes at about half the previous slope and creeps upward again. That is the congestion window halving on loss and then growing by one segment per round trip.
Then compare the SHAPE at the very beginning against the shape after a loss. The opening is curved — the window doubling every round trip, which is slow start — and the recovery is straight. Two different growth laws, visible with your eyes, on your own machine.
Plot it BY HAND on graph paper before letting any tool draw it for you: read twenty sequence numbers off the capture, one per round trip, and mark them. Drawing the curve yourself is what makes the change of slope obvious, and it costs five minutes.
Materialien für diesen Schritt:
Graph Paper2 BlätterBenötigte Werkzeuge:
Desktop Computer
Steel Rule3
3
Window, collapse, and why AIMD
Window, collapse, and why AIMD
Jupyter-Notebook wird geladen …
Benötigte Werkzeuge:
Desktop Computer4
4
Compendium: the promise, and who keeps it
Compendium: the promise, and who keeps it
WHY THE ENDPOINTS AND NOT THE NETWORK. The end-to-end argument says that a function which must be correct end to end cannot be completely implemented in the middle — a router that guarantees delivery to the next router has still not guaranteed delivery to the application, so the endpoints must check anyway. Given that, the middle should not bother, and the ARPANET's careful hop-by-hop reliability from blueprint 6 was moved outward. It is the reason a router can reboot mid-transfer and lose nothing that the two ends cannot recover.
THE SIBLING, AND WHY BOTH SURVIVE. TCP: reliable, ordered, congestion-controlled, and it will WAIT — a segment lost at the start of a stream stalls everything behind it, however useless that stalled data has become. UDP: none of the above, and therefore never late on purpose. For a file the first is obviously right; for a voice call a packet that arrives after its moment has passed is worse than no packet at all. Both are correct answers to different questions, and the 1978 decision to split Cerf and Kahn's single protocol into IP plus TCP is what left room for the second one to exist.
THE UNENFORCEABLE AGREEMENT. Nothing compels a sender to back off. The whole internet's stability rests on essentially every implementation choosing to be polite, and on the fact that the impolite ones mostly hurt themselves too. There is no authority, no admission control and no reservation — which is exactly the property packet switching bought in blueprint 5, seen from the far end of the batch.
Materialien
1- 2 BlätterPlatzhalter
Verwandte Blueprints
Diese Blueprints teilen Wissen — Techniken, Materialien oder Prinzipien
CC0 Gemeinfrei
Dieser Blueprint ist unter CC0 veröffentlicht. Sie dürfen dieses Werk für jeden Zweck frei kopieren, ändern, verbreiten und verwenden, ohne um Erlaubnis zu fragen.
Unterstützen Sie den Maker, indem Sie Produkte über seinen Blueprint kaufen, wo er eine Maker-Provision von Anbietern festgelegt, verdient. Oder erstellen Sie eine neue Iteration dieses Blueprints und verbinden Sie ihn in Ihrem eigenen Blueprint, um Einnahmen zu teilen.




