Latency
Latency is how long it takes for data to make a round trip between two points. If bandwidth is how wide the highway is, latency is how long the drive takes. Low latency means fast response times (a web page loads instantly). High latency means noticeable delays (a video call stutters, a game lags). Latency is usually measured in milliseconds, and anything under 50ms feels instant to humans.
Latency is the time delay between initiating a network request and receiving the response. It is typically measured as round-trip time (RTT): the time for a packet to travel from source to destination and back.
Latency components:
- Propagation delay: time for a signal to physically travel the medium. Speed of light in fiber is approximately 200,000 km/s; a cross-country US trip (~4,000 km) adds ~20ms one-way.
- Transmission delay: time to push all bits of a packet onto the wire. Inversely proportional to bandwidth.
- Processing delay: time for routers/switches to inspect headers and make forwarding decisions. Typically microseconds.
- Queuing delay: time a packet waits in a buffer when a link is congested. The most variable and problematic component.
Latency benchmarks:
| Scenario | Typical RTT |
|---|---|
| Same LAN | < 1ms |
| Same city | 1-5ms |
| Cross-country (US) | 30-70ms |
| Transatlantic | 70-120ms |
| Satellite (GEO) | 500-700ms |
| Satellite (LEO/Starlink) | 25-60ms |
Jitter: the variation in latency between consecutive packets. Low jitter is critical for real-time applications (VoIP, video). Typical jitter target: < 30ms.
Factors that increase latency: physical distance, network congestion, too many routing hops, DNS resolution, TLS handshake (1-2 RTTs), TCP slow start, geographic routing inefficiency.
Measuring and diagnosing latency
# Basic latency measurement with ping
$ ping -c 5 8.8.8.8
round-trip min/avg/max/stddev = 11.2/12.8/15.1/1.4 ms
# Trace the path and per-hop latency
$ traceroute -n 8.8.8.8
1 192.168.1.1 1.234 ms
2 10.0.0.1 5.678 ms
3 72.14.215.85 11.234 ms
4 8.8.8.8 12.456 ms
# Continuous latency monitoring with mtr (combines ping + traceroute)
$ mtr -n --report 8.8.8.8
HOST Loss% Snt Last Avg Best Wrst StDev
1. 192.168.1.1 0.0% 10 1.2 1.3 0.9 2.1 0.4
2. 10.0.0.1 0.0% 10 5.4 5.8 4.9 7.2 0.7
3. 72.14.215.85 0.0% 10 11.1 11.5 10.8 13.2 0.8
4. 8.8.8.8 0.0% 10 12.3 12.8 11.2 15.1 1.4
# Measure HTTP latency (time to first byte)
$ curl -o /dev/null -s -w "DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS: %{time_appconnect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n" https://example.com
DNS: 0.012s
Connect: 0.045s
TLS: 0.098s
TTFB: 0.156s
Total: 0.162s Latency is the metric that users feel most directly. A 100ms increase in page load time can reduce conversion rates measurably. CDNs exist primarily to reduce latency by serving content from geographically closer servers. In gaming, latency above 100ms creates noticeable lag. For database queries, the latency difference between a local SSD (0.1ms) and a network call to a remote database (5-50ms) is enormous when multiplied by thousands of queries per page load. Cloud region selection is a latency decision: deploying in us-east-1 when your users are in Europe adds 80-100ms to every request. The mtr tool is the gold standard for diagnosing where latency is introduced along a network path.