> ## Documentation Index
> Fetch the complete documentation index at: https://miliracle.online/llms.txt
> Use this file to discover all available pages before exploring further.

# 01 · Primer on Latency and Bandwidth

> What actually makes a network slow, and which half you can buy your way out of.

<Info>
  Chapter 1 of [High Performance Browser Networking](/reading/high-performance-browser-networking) · [Read the chapter](https://hpbn.co/primer-on-latency-and-bandwidth/)
</Info>

## The Many Components of Latency

Latency is the time it takes for a message or packet to travel from the origin point to the destination.

```mermaid theme={null}
flowchart LR
    C[Client] -->|packet| R
    subgraph R[" Router "]
        direction TB
        Q["① Queuing<br/>wait in the buffer"] --> P["② Processing<br/>read header, check errors"]
        P --> T["③ Transmission<br/>push bits onto the link<br/>size ÷ bitrate"]
    end
    R -->|"④ Propagation<br/>distance ÷ speed"| S[Server]
```

## Speed of Light and Propagation Latency

Light in fiber travels at roughly 200,000,000 m/s — about 1.5× slower than in a vacuum, because the refractive index of glass is \~1.5.

| Route | Distance | Light in vacuum | Light in fiber | RTT in fiber |
| - | - | - | - | - |
| New York to San Francisco | 4,148 km | 14 ms | 21 ms | 42 ms |

That 42 ms is the floor. No protocol, no server, no amount of money removes it.

## Last-Mile Latency

The largest latency typically occurs in the "last mile" — from home/office to your ISP's first routing node — not on transoceanic routes.

Reason: ISPs must run cables through residential areas, consolidate signals, then route to core nodes. These first few hops consume dozens of milliseconds.

## Bandwidth in Core Networks

A single optical fiber carries many wavelengths at once through wavelength-division multiplexing (WDM), so total link bandwidth is per-channel rate × number of channels. As of 2010, 400+ wavelengths at 171 Gbit/s each — over 70 Tbit/s on one fiber. Matching that with copper would take thousands of links.

The backbone is not the bottleneck.

## Bandwidth at the Network Edge

Your available bandwidth is the capacity of the *lowest*-capacity link between client and server — and that link is almost always at the edge, not the core.

| Rank | Country | Average Mbps | YoY |
| - | - | - | - |
| – | Global | 5.1 | 14% |
| 1 | South Korea | 20.5 | -19% |
| 21 | United States | 12.6 | 9.4% |

*Akamai, Q3 2015, excluding mobile carriers (mobile is slower and far more variable).*

For scale: HD video needs 2–10 Mbps depending on codec and resolution. The global average barely covers one stream.
A speed test measures the hop to your ISP, not end-to-end performance. Congestion at any intermediate node changes the answer.

## Bandwidth Scales, Latency Does Not

| | Bandwidth | Latency |
| - | - | - |
| Ceiling | None in practice | Speed of light |
| How to improve | Add fibers, add links, upgrade WDM | Better materials, shorter cable routes |
| Headroom left | Large — 2011 subsea links ran at \~20% utilization, and half the added trans-Pacific capacity from 2007–2011 came from WDM upgrades on *existing* fiber | \~30% — we are already at \~2/3 the speed of light |
| Nature of the problem | Economics | Physics |

Shortening the distance is the only real lever on latency, and laying new cable is constrained by terrain, politics, and cost.

<Note>
  **Bandwidth is an economics problem; latency is a physics problem.**

  So optimize the application, not the wire: cut round trips, move data closer to the client (CDN), and hide latency with caching and pre-fetching.
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.