Numbers every engineer should know
Distance sets a floor no server beats: count round trips, weigh them in powers of ten, and give each SSD figure its drive and year.
Predict first
Before you read: predict
ExamHall's autosave runs in Frankfurt (eu-central-1). A proposal makes each autosave wait until a synchronous replica in Ashburn, Virginia (us-east-1), holds the write and acknowledges it. Frankfurt to Ashburn is 6,549 km along the great circle. The options are about 2× apart or more, so round as you like.
Before any routing detour, queueing or disk work, what is the least time each autosave must wait for that acknowledgement?
The 30-second version
Think in powers of ten: a memory reference is about 100 ns, a round trip inside one data centre about 0.5 ms. Light in fibre covers 200 km a millisecond, so a round trip costs at least 1 ms per 100 km. Waiting calls pay one round trip each. Give any SSD figure its drive and year.
Distance sets a floor no server beats: count round trips, weigh them in powers of ten, and give each SSD figure its drive and year.
How it works
Step 1 of 12
In the kitchen
- a glance at your own flock → a memory reference (step 1)
- a word with the shepherd at your elbow → a round trip inside one data centre (step 1)
Analogy: Two shepherds calling across a mountain valley (hill farming)
| In the valley | In the system |
|---|---|
| a glance at your own flock | a memory reference (step 1) |
| a word with the shepherd at your elbow | a round trip inside one data centre (step 1) |
| a call across the valley, and its answer | a round trip between regions (step 2) |
| no answer arrives before the sound has crossed twice, however quickly the far shepherd replies | the floor (steps 4–5) |
| twelve questions, each waiting for the last answer, cost twelve crossings | a sequential chain (step 7) |
| shouting louder carries no word faster | bandwidth is not latency (step 9) |
| walking over to share one hillside | moving the service next to its caller (steps 7–8) |
| "sound covers a kilometre in about three seconds" holds for air at one temperature; a frosty dawn differs from a warm afternoon | a figure needs its drive and year (steps 10–11) |
Breaks down when: a shout fades with distance until nobody hears it, while fibre is boosted every hundred kilometres or so and still arrives. And the ratios are tame: the far call takes perhaps a hundred times the near word, while a cross-region round trip is hundreds of thousands of memory references.
Contrasting case: leaving a note in the hut on the valley floor for the other shepherd to read later. Nobody waits for an answer, like asynchronous replication, where the primary sends the write on and does not wait; how replicas lag is db-replication-read-replicas.
In real terms: a network call costs at least one round trip, whose floor is set by distance; count the calls that wait on each other, multiply, and compare in powers of ten.
Examples, run for real
4.1 ExamHall EXH-2400: the room overview read from Dublin
The proctor console's room overview, served from Frankfurt, took over half a second to draw. It read each candidate's status from the attempt service, one after another, and that service had been deployed to Dublin (eu-west-1):
4.1 Frankfurt -> Dublin 1,088 km great circle · fibre floor 10.9 ms a round trip (2 x 1,088 km / 200,000 km/s)
4.1 48 reads one after another x (10.9 ms + 1.5 ms work) = 594 ms · round trips 522 ms (88%) · work 72 ms (12%)
4.1 MR !2700, one call for the room's 48 statuses: 10.9 ms + 72 ms = 83 ms
Each read was quick in Dublin; the wire took most of the time (steps 5, 7 and 8). MR !2700 asks for the room's statuses in one call, so the room waits for one round trip instead of 48.
4.2 Ticketing: a faster link for the seat map
A box office's API in Dublin sends a 2 KB seat map to a sales partner in London. The partner pays for a link ten times as fast:
4.2 Dublin -> London 463 km · fibre floor 4.6 ms a round trip
4.2 2 KB at 1 Gbit/s: sending 16.0 µs · round trip plus sending 4.649 ms
4.2 2 KB at 10 Gbit/s: sending 1.6 µs · round trip plus sending 4.635 ms (0.3% less)
Ten times the bandwidth shortens only the sending, a few microseconds of a trip of several milliseconds (step 9).
4.3 The tables, read with their year
Dean's table measured a packet from California to the Netherlands and back; this lesson takes San Francisco and Amsterdam as its ends. Colin Scott's page computes its figures from a year, and its code is in the page:
4.3 gist (~2012) "Send packet CA->Netherlands->CA" 150 ms · San Francisco -> Amsterdam 8,772 km · fibre floor 87.7 ms · the table's figure is 1.7x the floor
4.3 random 4 KB SSD read: gist (~2012) 150 µs · Colin Scott's getSSDLatency() 2012 16.4 µs, 2015 16.0 µs, 2020 16.0 µs, 2026 16.0 µs
Dean's packet took well above the floor: real routes are longer (step 6). The two SSD figures disagree even for 2012, and Colin Scott's code returns one constant for every year after 2014: each is a model of some drive, not a law (steps 10–11).
Try it
Answer first, then check. Nothing is saved.
Question 1 of 5
A ticketing API checks a rate limit on every request. Version A keeps each client's counter in a Map inside the API process, and a check costs about one main-memory reference. Version B keeps the counters in Redis on another server in the same data centre, and a check is one GET there and back.
About how many version-A checks take as long as one version-B check?
Question 2 of 5
A seat-booking flow calls an inventory service 20 times, each call waiting for the previous answer, over one connection that stays open. Each call spends 1 ms in the service. Today the service runs in the flow's own data centre, where a round trip takes about 0.5 ms. The plan moves it to a region 1,500 km away.
Before any routing detour or queueing, about how many times as long will the 20 calls take after the move?
Question 3 of 5
A payments company in London wants to confirm card payments with a partner bank in New York, 5,570 km away along the great circle. A network vendor promises a 45 ms round trip between the two cities over its own private fibre, and today's ping between them shows 74 ms.
Can the vendor keep that promise?
Question 4 of 5
A streaming service's catalogue cache misses now and then. A miss reads 6 index pages one after another, each a random 4 KB read from the server's local SSD, and the team's budget for those reads is 0.6 ms. Two design notes disagree: one budgets 150 µs per read, citing Jeff Dean's latency table (~2012); the other 16 µs, citing Colin Scott's interactive latency page. The team has since measured the server's own drive: 90 µs per random 4 KB read.
Which conclusion holds?
Question 5 of 5
A ticket-resale site's checkout service runs in Madrid. To price a seat map it calls a pricing service in Ashburn, Virginia, 6,116 km away along the great circle, once per section: 24 sections, each call waiting for the previous section's result, over one open connection. Each call spends 4 ms in the pricing service.
Which change brings the 24 calls under 200 ms?
Go deeper
Pro tips
- Get the distance before you argue about latency: a haversine one-liner over two cities' coordinates gives the great circle, and the floor follows from it. Tokyo to Los Angeles, with Wikipedia's coordinates and a 6,371 km Earth:
When: any design that puts a call or a replica in another region (steps 5–6). Verify:node -e "const r=Math.PI/180,[a,b,c,d]=[35.68972222,139.69222222,34.05,-118.25];console.log(Math.round(2*6371*Math.asin(Math.sqrt(Math.sin((c-a)*r/2)**2+Math.cos(a*r)*Math.cos(c*r)*Math.sin((d-b)*r/2)**2))))"tip Tokyo -> Los Angeles: haversine 8,815 km on R 6,371 km · fibre floor 88.2 ms a round tripStatus: RAN.
Source
Every graded script reads its figures from these files and checks each hash first. Quotes below are verbatim with runs of spaces collapsed (the gist aligns its columns with spaces). Latency tables and interview guides change: the figures below are as of 2026-10-01. No item is keyed on a quoted passage; every key is executed. Valid as of 2026-10-01.
- Jonas Bonér, "Latency Numbers Every Programmer Should Know" (gist, after Jeff Dean and Peter Norvig): https://gist.github.com/jboner/2841832 (
jboner-gist.txt, the raw view). The row's named anchor source. Quoted: the header "Latency Comparison Numbers (~2012)"; "Main memory reference 100 ns"; "Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD"; "Round trip within same datacenter 500,000 ns 500 us"; "Disk seek 10,000,000 ns"; "Send 1K bytes over 1 Gbps network 10,000 ns"; "Send packet CA->Netherlands->CA 150,000,000 ns". As of 2026-10-01 the gist also carries rows marked "(2026)" for language-model latencies under the same "~2012" header; this lesson uses none of them. Supports steps 1, 3, 9, 10 and 12. - Colin Scott, "Numbers Every Programmer Should Know By Year" (interactive): https://colin-scott.github.io/personal_website/research/interactive_latency.html (
colin-scott-latency.txt, the static HTML unchanged). The page draws its table with JavaScript, so the saved text holds no table, only the code. Quoted from it: "All of Norvig's original numbers were from 2002"; ingetSSDLatency(), "Will flat-line in one capacity doubling cycle", "20 us = 2*10^4 ns in 2012" andreturn 16000;for every year after 2014. Supports step 10. - Hello Interview, "Numbers to Know": https://www.hellointerview.com/learn/system-design/core-concepts/numbers-to-know (
hellointerview-numbers.txt). The row's second guide. Only the public opening is readable; the rest says "Purchase Premium to Keep Reading". Quoted, as of 2026-10-01: "Latency remains predictable: sub-1ms within a single AZ, 1-2ms across AZs in the same region, and 50-150ms cross-region"; "They do scale calculations using numbers from 2015 (or even 2020!) that dramatically underestimate what modern systems can handle." Supports steps 2 and 11. - Peter Norvig, "Teach Yourself Programming in Ten Years", Answers: https://norvig.com/21-days.html (
norvig-21-days.txt). The gist's credited original. Quoted: "fetch from main memory 100 nanosec"; "send packet US to Europe and back 150 milliseconds". Supports step 1. - Wikipedia, Optical fiber: https://en.wikipedia.org/wiki/Optical_fiber (
wp-optical-fiber.txt). Quoted: "a simple rule of thumb is that a signal using optical fiber for communication will travel at around 200,000 kilometers per second"; a single-mode fibre's "core of doped silica with an index around 1.4475". Supports steps 4–5. - Wikipedia, Speed of light: https://en.wikipedia.org/wiki/Speed_of_light (
wp-speed-of-light.txt). Quoted: "exactly 299792458 m/s"; "the speed of light is slower by about 35% in optical fibre with an refractive index n around 1.52". - Wikipedia, Latency (engineering): https://en.wikipedia.org/wiki/Latency_(engineering) (
wp-latency-engineering.txt). Quoted: "This works out to about 5.0 μs of latency for every kilometer"; the fibre path "is rarely a straight line, since it has to traverse geographic contours and obstacles"; "For distances of greater than 100 kilometers, amplifiers or regenerators are deployed." Supports steps 4 and 6 and the analogy's limit. - Wikipedia, Solid-state drive: https://en.wikipedia.org/wiki/Solid-state_drive (
wp-solid-state-drive.txt). Quoted: "SSDs have no moving parts"; "As SSDs do not need to spin or seek to locate data". Supports step 12. - Wikipedia, Earth radius: https://en.wikipedia.org/wiki/Earth_radius (
wp-earth-radius.txt), "usually considered to be 6,371 kilometres", and the articles' primary coordinates from the MediaWiki API (wp-coordinates.txt). Every great-circle distance in this lesson is a haversine on those two. - Wikipedia, Speed of sound: https://en.wikipedia.org/wiki/Speed_of_sound (
wp-speed-of-sound.txt), for the analogy: "At 20 °C (68 °F), the speed of sound in air is about 343 m/s … or 1 km in 2.92 s"; "It depends strongly on temperature". - Not fetched for this lesson: Wikipedia's Little's law, the row's last source. Its lesson belongs to
scale-littles-law-capacity(curriculum bridge, DEC F7), and no item here uses it.
Related lessons
Checked against the tools and docs as of 2026-10-01.