Hone

Lessons · IT support · latency and bandwidth

Bandwidth is how wide the pipe is; latency is how long the pipe is

Bandwidth is how much data can move per second. Latency is how long one trip takes, there and back, whatever the size. A fast line to a far-away server can be slow for a page that needs many small round trips, and no amount of bandwidth shortens a round trip.

Hone is a place to practise a career, one idea a day. This is one of its lessons, written out in full and free to read without an account.

What it is for

The remote office has a 1 Gbps line and complains that the ordering system is slow. Downloads fly. Every click waits. ping to the server says 180 ms, and each screen needs five round trips before it draws anything: nearly a second per click, with the line almost empty. A faster line would change nothing; a server nearer to them, or fewer round trips, would.

How to think about it

Ask which kind of slow: big files slow, or every click slow. Big files: bandwidth; measure it. Every click: latency; ping the server and read the time. Multiply the round-trip time by the number of trips a task needs and you have the floor under that task, the time it can never beat however fast the line is.

Worked example

ping orders-server → 180 ms
One round trip, there and back, on an idle line. That is the latency.
Each screen: 5 round trips before it draws
The program talks back and forth five times. Each one waits for the last.
5 × 180 ms = 900 ms per click
Nearly a second per click, with the line carrying almost nothing. The width of the pipe never entered the sum.
Line speed: 1 Gbps, measured 940 Mbps
The bandwidth is fine. The ticket goes to whoever can move the server closer or cut the trips, not to whoever sells lines.

Your turn

Round trip 120 ms, a task that needs 4 round trips. Write the time the task can never beat.

4 × 120 ms =  ms

The trap

Ordering a faster line for a latency problem. The bandwidth graph shows the line is nearly empty, and the sales team still sells the upgrade. Read the ping time before you read the brochure.

Practise latency and bandwidth on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.