GOAT EngineerPreparing your learning space…

System Design · Concept Library · Free article

Network latency and the speed of light

Most of the wait for a distant user is distance, not slow code. A signal in fibre covers about 200,000 km per second, so a cross-ocean round trip costs roughly 150 ms before a server does anything, and a cold connection can stack several of them.

Distance sets a latency floor. A signal in fibre travels at roughly 200,000 km per second, so an intercontinental round trip can cost around 150 ms before server work. Sequential setup can multiply that floor: an illustrative cold HTTPS-over-TCP path with DNS, TCP, TLS 1.3, and the request is about four round trips, while other protocol and cache states differ. When propagation dominates, the two network levers are shorter distance and fewer sequential trips. Queueing, processing, loss, transfer time, and client work can dominate elsewhere, so measure the full path.

Why Zoe waits 600 ms for a healthy service

Hatch has gone global. A short-link redirect takes about 600 ms for Zoe in Sydney but 50 ms for a user near the Seattle region. The servers are healthy, the database is fast, and the cache is warm.

Distance is a major part of the difference. Zoe’s request crosses the Pacific and returns, potentially more than once during setup. This article separates that propagation floor from queueing, processing, packet loss, transfer time, and client work, then shows which changes reduce each cost.

What causes network latency?

Distance, mostly, and it sets a floor nothing above the network can lift. Internet data travels as light through glass fibre. Fibre slows the signal to about two-thirds of the speed of light in a vacuum, or roughly 200,000 kilometres per second. Sydney and Seattle are about 12,500 km apart. At 200,000 km/s, a signal needs about 62 ms to travel that distance and another 62 ms to return. That gives a ~125 ms round trip before a server does any work. Real cables do not follow a straight line, and network equipment adds delay, so an observed round trip may be closer to 150 to 180 ms.

The one-way travel time is propagation delay. The time for a message to travel to its destination and for the response to return is the round-trip time, or RTT. Most examples on this page use RTT because the requester waits for the response. Distance and signal speed set its physical floor. A faster server, network link, or database cannot shorten the ocean crossing. Change the distance below to see how the floor moves:

The interactive version of this example is available when JavaScript loads.

A cold request can stack several round trips

A 150 ms round trip can become a 600 ms wait because loading a page may require several sequential exchanges. Before the server sends the page, the browser may need to resolve the address, open a connection, secure it, and request the data:

  1. Find the address (DNS). The browser knows the name (hatch.link) but not the numeric address of a server. Looking it up is often a round trip of its own. Its own page: DNS.
  2. Open the connection (TCP handshake). The two computers exchange a short sequence to establish the connection. This usually costs one round trip before application data moves. Read TCP handshake for the mechanics.
  3. Secure it (TLS handshake). The peers exchange the information needed to encrypt the connection. Depending on the protocol and connection state, this has historically cost one or two round trips. Read TLS for the mechanics.
  4. Request the data. The browser sends the application request and waits for the response.

In the simplified cold TLS 1.3 example, DNS (1) + TCP (1) + TLS (1) + request (1) gives about four round trips, or roughly 600 ms when each origin-sized RTT is 150 ms. DNS often uses a different, nearer resolver path; TLS 1.2 can add another RTT; cached DNS, reuse, and HTTP/3 can remove or combine steps. Use the model to count sequential waits, not as a universal page-load formula:

The interactive version of this example is available when JavaScript loads.

The latency ladder: from a nanosecond to an ocean

Engineers carry rough latency orders of magnitude because design decisions live in the gaps. A CPU cache access is sub-nanosecond, RAM is around 100 ns, an SSD read may be around 100 microseconds, a datacentre round trip around 0.5 ms, a continental RTT tens of milliseconds, and a cross-ocean RTT around 150 ms. These are orientation numbers, not a ladder with a fixed multiplier between every rung.

Those numbers are easier to compare on a human timescale. If reading from the CPU’s fastest cache took 1 second, reading from RAM would take about 3.5 minutes, an SSD read about 2 days, a cross-country round trip about 4 years, and a cross-ocean round trip about 9 years. The comparison shows why network travel can outweigh local processing for a distant user.

The interactive version of this example is available when JavaScript loads.

A fatter pipe doesn’t make a round trip shorter

Latency measures how long it takes useful data to arrive. Bandwidth measures how many bits per second the connection can carry once data is flowing. A truck full of hard drives can move terabytes of data, giving it high bandwidth, but the first byte takes days to arrive. Its latency is poor. A network link can also have high bandwidth and a long delay.

Zoe’s redirect response is only a few hundred bytes, so transfer time is small. Giving her more bandwidth will not materially shorten the repeated ocean crossings. Large transfers such as video and big files are different because transfer time can dominate. Use the controls below to compare a small response with a large payload:

The interactive version of this example is available when JavaScript loads.

Why do sequential calls cost more than parallel ones?

Because sequential waits add and parallel ones do not. A page may load fonts and images while calling several APIs. If ten independent calls run one after another and each takes 150 ms, their network waits add up to about 1.5 seconds. If they start together, the total is closer to the slowest call, about 150 ms in this simplified example. Calls with true data dependencies still have to run in sequence.

When a parent request waits for several required calls, the slowest call on that critical path sets its completion time. More independent calls create more chances that at least one is slow: ten calls with a 1% tail probability produce about a 9.6% chance of hitting at least one tail call. That is not automatically a typical page, but it explains why fan-out often worsens the parent distribution. See p99 and percentiles:

The interactive version of this example is available when JavaScript loads.

How do you reduce network latency?

With two levers, and only two, once propagation and connection setup dominate: shorten the path, and cut the number of sequential exchanges along it. Other delays, including queueing, processing, packet loss, transfer time, and client work, require different fixes.

Lever 1: shorten the distance

  • Cache copies near users (edge or CDN). A nearby cache can answer a hot read without sending it across an ocean. In the example, that can replace a ~150 ms intercontinental RTT with a much shorter regional RTT.
  • Put servers and data in regions near users. Run application servers near the audience and use a read replica when the consistency requirements allow local reads.
  • Anycast routing. Advertise one address from many locations so BGP sends traffic along its preferred route, often to a nearby site but not necessarily the geographically nearest one.

Lever 2: make fewer round trips

  • Reuse the connection (keep-alive). Pay the TCP and TLS setup once, then send later requests over the warm connection.
  • Newer protocols. TLS 1.3 cuts the security handshake to a single round trip, and a resumed connection may avoid an extra handshake trip. HTTP/3 uses QUIC to combine transport and security setup and isolate loss between streams. The distance stays the same, but the path may need fewer sequential trips.
  • Batch and parallelise. Combine several small calls into one, and fire independent calls together instead of in series (the previous section).
  • Reduce transfer work. Compress large payloads and serve static assets from the edge. This affects transfer time as well as path length.

Is it distance, or is it your server?

A slow page does not identify its own bottleneck. Separate network travel from connection setup, server work, transfer time, and client rendering before choosing a fix:

  • ping provides a rough path signal. ICMP can follow a different path or receive different priority from application traffic, so it cannot decompose page latency by itself.
  • traceroute shows the path and the reported time to each hop. Treat individual hop times carefully because routers may deprioritise these responses.
  • Browser timing, TTFB, and Server-Timing expose DNS, connection, TLS, request, and first-byte timing on the application path. Correlate them with traces to separate proxy, queue, database, and handler work.
  • Real User Monitoring (RUM) by geography shows what users in each region experience. A global average can hide a poor p99 on one continent.

When latency isn’t your problem

Edge networks and regional replicas add cost and operational complexity. They are often worthwhile for interactive paths such as redirects, search, and checkout, where a person waits for the response. Batch jobs, data pipelines, and video encoding often care more about throughput and total completion time. Optimise the metric that matters to the workload.

Signs latency isn’t the thing to fix

  • No human is waiting. If it’s a batch job or an async queue, optimise throughput and cost, not round trips.
  • Your users are already close. If users and servers share a region, inspect connection setup, queueing, server work, transfer time, and client work.
  • The payload is large. Transfer time may dominate. A CDN can still help, but bandwidth and payload size become part of the diagnosis.
  • The path RTT is small but the page is slow. Measure the application protocol and server spans. A small ICMP RTT does not rule out every network problem.

How does a CDN reduce latency?

Submarine cables carry most intercontinental internet traffic. Content delivery networks (CDNs) place cached content in many locations so users can often reach a nearby copy. Anycast advertises the same address from multiple sites, allowing BGP to choose a preferred route that is often nearby but not necessarily the geographically closest. Some latency-sensitive firms also pay for straighter fibre routes or experiment with hollow-core fibre, where light travels through air rather than solid glass.

Parallelise independent calls

Code can add avoidable network waits by sending independent requests one at a time. Starting them together makes the total approach the slowest call instead of the sum. Suppose each of these three lookups takes about 150 ms:

  • Serial calls. const user = await getUser(id), then const prefs = await getPrefs(id), then const feed = await getFeed(id). Each call waits for the previous one, so the total is about 150 + 150 + 150 = 450 ms.
  • Parallel calls. const [user, prefs, feed] = await Promise.all([getUser(id), getPrefs(id), getFeed(id)]). The calls start together, so the total is about max(150, 150, 150) = 150 ms.

Pitfalls

  • Optimising the server before measuring the path. If propagation already accounts for most of the wait, query tuning will have little effect. Compare network and server timing first.
  • Testing latency only from near your servers. Your laptop is next door to production, so everything looks fast. Measure from real users’ regions or you’ll never see the p99 that’s hurting people.
  • Paying handshakes on every request. No connection reuse means every call re-runs TCP + TLS. Turn on keep-alive / connection pooling so setup is paid once.
  • Serial round trips for independent work. Awaiting calls one by one adds their latencies. Fire independent calls in parallel.
  • Buying bandwidth for a small-request problem. Bandwidth does not shrink a round trip. For small payloads, propagation, setup, and server work are usually more useful places to investigate.
  • Judging on the average, not the tail. A page waits on its slowest sub-request; a good average with a bad p99 still feels broken.

Best practices

  • Place caches or replicas closer when propagation dominates and the data model permits it.
  • Reuse connections so TCP and TLS setup is not repeated for every request.
  • Use TLS 1.3 or HTTP/3 where they fit the stack and client population.
  • Start independent calls together; keep true dependencies sequential.
  • Measure real users by geography and track the tail as well as the average.
  • Prioritise interactive paths where a person waits for the result.

The takeaway

Sources and further reading

By GOAT Engineer. Back to Concept Library. Privacy Policy · Contact.