Lessons 1/4 · 20 min
Latency and bandwidth: what distance costs
The starting question
You send a 5 MB file to a distant server. Your connection advertises 40 Mbit/s. How long will it take? Many answer: "5 MB = 40 megabits, so one second". That is wrong as soon as the server is far away. The latency is missing.
Two different quantities
- Bandwidth: how many bits pass per second, in Mbit/s. It is the width of the pipe.
- Latency: the time for a message to go from one point to another. Often we speak of the round-trip time (RTT). It is the length of the pipe.
A truck can carry an enormous amount of data (high bandwidth) but take a day (high latency). An SMS is small but arrives quickly.
A physical limit
Light in an optical fibre travels at about 200,000 km/s, roughly two thirds of its speed in vacuum. This is not an operator's flaw: this limit holds for conventional fibre; only the speed of light in vacuum is an absolute bound (microwave or hollow-core links get closer to it, without exceeding it). Take two hypothetical data centres 6,000 km apart:
- one way: at least 6,000 ÷ 200,000 = 0.03 s = 30 ms;
- round trip: at least 60 ms, in reality more, because fibre does not follow the straight line and routers add delays.
A worked example: the workshop's simplified model
Total time = (number of setup round trips) × RTT + size × 8 ÷ bandwidth. For 5 MB, 40 Mbit/s, RTT = 120 ms and 2 setup round trips:
- transmission: 5 × 8 ÷ 40 = 1 s = 1,000 ms;
- setup: 2 × 120 = 240 ms;
- total: 1,240 ms.
Divide the size by 10 (500 KB): transmission falls to 100 ms but setup stays at 240 ms. For small messages latency dominates; for big files, bandwidth. A consensus message is small: the whole life of a consensus protocol is therefore paced by round trips.
Explore the request-path tool: DNS, TCP, TLS then HTTP chain several exchanges before the first useful byte flows. The model is deliberately simplified (for example it ignores reused connections).
The key point: slow or dead?
Node A sends a request to B and waits. After 2 seconds without an answer, what does A know? Nothing certain. B may have crashed, the network may have lost the message, or the reply may arrive in 3 seconds. From A's side these three cases are indistinguishable. The only weapon is the timeout, which is an assumption, not a proof: set too short, it declares a merely slow node "dead"; too long, it delays every reaction.
What this does NOT guarantee
A low RTT measured this morning does not guarantee tomorrow's. Latency varies (congestion, changed route); a serious protocol assumes no bound, or states one explicitly as an assumption.
Recap
- Bandwidth = width of the pipe, latency = its length; small messages are dominated by latency.
- Light in fibre sets a minimum of roughly 1 ms of round trip per 100 km (an order of magnitude).
- A slow node cannot be told from a dead one; a timeout is a bet.
Interactive tool
Journey of a web request
Four steps between typing an address and seeing the page, and what someone listening on the network (public Wi-Fi, ISP) sees at each step.
Step 1 of 4
DNS lookup
The browser asks a resolver for the IP address of example.org (A/AAAA query).
What an on-path observer sees
HTTP (unencrypted)
- The name asked for (example.org) and the IP returned, in the clear on port 53, unless encrypted DNS is used.
- Who queries which resolver, and when.
HTTPS (TLS)
- Same: HTTPS does not protect the DNS query. The name is visible unless encrypted DNS (DoH, DoT, DoQ) is enabled.
- With encrypted DNS: the observer only sees that you talk to your resolver, not the name or the answer. The resolver itself still sees the name.
"On-path observer": a third party who reads traffic without being one of the two endpoints (Wi-Fi network, ISP, intermediate router). They do not see what the server itself sees.
