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
WHERE A 4-SECOND PAGE LOAD ACTUALLY GOES (mid-tier phone, 4G)
0ms 4000ms
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
βDNSβ TCP+TLS β HTML β JS + CSS β API β paintβ
β120β 340 β 600 β 1900 β 900 β 140 β
βββββ΄ββββββββββββ΄βββββββββββ΄ββββββββββββββββββββββ΄ββββββ΄βββββββ
βββββββββββββ network: 3860ms (96%) ββββββββββββββββββΊ ββ CPU
140ms
Optimising the 140ms of rendering is a rounding error.
Optimising the 3860ms of waiting is the job.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.