The Runtime Theory
easyreference#estimation#latency-budgeting

Estimate Cross-Country Request Latency

Use back-of-envelope numbers to estimate the latency of a cross-country API request and identify which hop dominates the total cost.

The Runtime Theory Team1 min read
Solve it

Solving happens on the judge — come back and mark it done

Sample cases

inNYC to London request, no cache, one database round-trip

out~70-100ms dominated by cross-Atlantic round-trip

inNYC to SF request with CDN cache hit

out~5-15ms dominated by last-mile delivery

Estimate the end-to-end latency of a user request from New York to a server in London, where the request must read from a database once.

Ground numbers

Use these as your baseline (realistic order-of-magnitude values):

  • Speed of light in fiber: ~200 km/ms
  • New York to London: ~5,500 km → ~28 ms one way, ~56 ms round-trip minimum
  • TLS handshake: 1-2 round-trips → adds ~56-112 ms on top of the base RTT
  • Cross-AZ database round-trip within a region: ~1-2 ms
  • A cache hit in the same data center: ~0.1-0.5 ms
  • CDN cache hit at the edge: ~1-5 ms

Questions

  1. If the TLS handshake costs one full round-trip and the HTTP request is another round-trip, and the database round-trip adds 1 ms, what is the minimum latency from browser click to response? Which hop dominates?
  2. If you could eliminate the database round-trip by caching, how much would you save as a fraction of the total?
  3. If you could move the server to a CDN edge location in London, reducing the client-to-server distance but not the database distance, how does that change the answer?

The point of this exercise is not precision — it is recognizing which hop is the bottleneck and designing around it. Read the latency and throughput primer and the browser request flow to check your reasoning.

More practice in this topic

One dispatch a week

The trace behind each problem, the tradeoff that explains it, and one technical dispatch per week — no noise.

One technical dispatch per week. No noise.

Not started

Sign in to save your learning progress.

Sign in to save