The Network Will Lose Some of Your Packets and Tell Nobody, So Everything Above It Is Built on Noticing
Last timeOpening a Conversation
Reliability is numbering, acknowledging, and resending what was not acknowledged. The mechanism is simple, and its cost is why a little loss hurts far more than it sounds.
Numbering and acknowledging
The network underneath makes no promises. A packet may be dropped by any router
along the way, usually because a queue was full, and nothing informs either
end. It may also arrive out of order, or twice. Reliability is not a property
of the network; it is something the two ends construct on top of an unreliable
one.
The construction has two parts. Every byte sent has a position in the stream,
agreed during the handshake. And the receiver reports, continuously, the
position up to which it has everything.
That second part is cleverer than it looks. The receiver does not describe what
arrived. It names one number: the first position it is still missing.
Everything below that number is known to have arrived, in one small field, no
matter how much has been sent.
| step | packet sent | what the receiver has | what it reports | what the sender concludes | what happened |
|---|---|---|---|---|---|
| 1 | bytes 1 to 100 | 1 to 100 | next I need 101 | all good | The ordinary case. One number summarises everything, and the sender advances. |
| 2 | bytes 101 to 200, lost | 1 to 100 | nothing to report yet | still waiting | Nothing announces the loss. The router that dropped it does not tell anybody, and the sender has no reason yet to suspect. |
| 3 | bytes 201 to 300 | 1 to 100, and 201 to 300 set aside | next I need 101 | a repeat, suspicious | The receiver cannot report 301, because 101 to 200 is missing and the report means everything below. So it repeats the old number, and that repetition is the signal. |
| 4 | bytes 301 to 400 | 1 to 100, and 201 to 400 set aside | next I need 101, again | that is three, resend it | Three repeats of the same number is the conventional threshold. The sender resends the missing range immediately rather than waiting for a timer. |
Two ways to notice
The sequence above is the good case, and it depends on something: later packets
kept arriving. That is what produced the repeated reports.
When nothing arrives after the loss, there is no signal at all. The sender has
sent something and heard nothing, and silence is indistinguishable from a slow
network. The only remaining mechanism is a timer.
| detected by repeated rep | cost in round trips | detected only by a timer | the sender waits in sile | |
|---|---|---|---|---|
| loss in the middle of a | 1 | 1 | 0 | 0 |
| loss of the last packet | 0 | 4 | 1 | 1 |
| loss when the receiver c | 1 | 1 | 0 | 0 |
| loss on a connection wit | 0 | 7 | 1 | 1 |
The timer cannot be set to the average round trip. If it were, ordinary
variation would make it fire when nothing was lost, and the sender would resend
data that is merely in flight, wasting capacity exactly when the network is
busy enough to be slow. So the timeout is built from a running estimate of the
round trip plus several times the observed variation in it, and it is floored
at a value well above any plausible round trip.
The lesson stops here
3 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents