Part I — The Pipes · Lesson 1.2
Why Networking Matters
In one lineMost of a page load is waiting, not computing — so most of your wins live in the network.
Where you've seen itZomato on a 3G train connection. The JavaScript executes in 40ms. The user still waits four seconds.
Diagram
LATENCY IS NOT BANDWIDTH
Bandwidth ↑ (1 Mbps → 10 Mbps) page load: 3.2s → 2.9s (-9%)
Latency ↓ (200ms → 20ms) page load: 3.2s → 1.1s (-65%)
Every round trip costs one RTT. Cut round trips, not just bytes.How it works
- A browser can only start work it has bytes for — everything serialises behind a fetch.
- Each new connection costs DNS + TCP + TLS, roughly 3 round trips before byte one.
- Round trips multiply on slow links; bytes only add.
- So the levers are, in order: fewer round trips → closer origin → fewer bytes.
Trade-offs
| Lever | Typical win | Cost |
|---|---|---|
| CDN / edge | 100–300ms per request | Cache invalidation complexity |
| HTTP/2 multiplexing | Removes per-file queueing | Needs HTTPS |
| Preconnect / preload | 1 RTT saved per origin | Wasted if unused |
| Bundle size cuts | Linear in bytes | Build complexity |
Interview angle
"The page is slow. Where do you look first?"
- Open the waterfall, not the profiler — confirm it's network-bound before touching code.
- Count round trips and identify the longest dependency chain, not the biggest file.
- Report at p75 on real devices; averages hide the users who churn.
Recap
- Page loads are dominated by waiting, and waiting is round trips.
- Latency hurts more than bandwidth on real networks.
- Fix order: fewer round trips → closer bytes → fewer bytes.