Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Latency Reduction at the Edge
HLD

Latency Reduction at the Edge

Beyond caching — connection reuse, protocol upgrades, and route optimization for the requests that must travel.

The Latency Budget Breakdown

 one HTTPS request, no cache hit:

 TCP handshake        1 RTT     ~70ms transatlantic
 TLS handshake       1-2 RTTs   ~140ms (TLS 1.2) 
 request/response     1 RTT     ~70ms
 ─────────────────────────────
 ≈ 280ms BEFORE your server thinks — even with a fast origin!

 edges attack EVERY line of this budget.

Weapon 1: Connection Termination and Reuse

 user ⇄ edge connection established ONCE, reused everywhere:

 user ──(persistent HTTP/2/3, TLS kept warm)──► [edge]
                                                 │ pooled keep-alive
                                                 ▼ connections to origin
 wins:
 - users skip handshake costs after first request
 - edge→origin uses LONG-LIVED pooled connections:
   origin handshake cost paid once per pool slot, amortized
 - mobile clients benefit most (handshakes over radio are brutal)

Weapon 2: Modern Protocols

 HTTP/2 at the edge:
 - multiplexing: many parallel streams on ONE connection
   (no more 6-connection browser limits, no head-of-line queuing
    AT THE APPLICATION LAYER)

 HTTP/3 (QUIC) at the edge:
 - 0-RTT/1-RTT handshakes: resumption in ONE round trip
 - runs on UDP: no TCP slow-start stalls; survives IP changes
   (wifi→cellular handoff without dropping transfers!)
 
 CDNs upgrade protocols to USERS even when origins speak HTTP/1.1 —
 you get modern-client performance for free.

Weapon 3: Route Optimization

 public internet paths are not shortest paths:

 user → origin direct:      congested transit hop, 180ms
 user → edge → optimized CDN backbone → origin: 95ms

 CDNs run private backbones between POPs;
 traffic rides monitored, tuned routes (like anycast +
 steering + peering relationships combined).

 dynamic content benefits too: the MISS path itself gets faster.
 this is why "uncacheable" sites still use CDNs.

Weapon 4: Compression and Shaping at Edge

 - brotli/gzip negotiated per client at edge (CPU cheap there)
 - image format negotiation: serve AVIF/WebP to capable browsers
 - minification/optimization as edge services
 smaller payloads = fewer packets = fewer RTTs on lossy links.

The Composite Effect

 measured typical improvements (far-region users):

 static asset:          280ms → 15ms     (cache + proximity)
 dynamic API call:      300ms → 120ms    (protocol + pooling + routing)
 first-byte TTFB p75:   40-60% reduction typical full-site

 latency compounds through page loads (request chains):
 cutting each hop's RTT multiplies across every dependent fetch.

Interview Framing

“CDN for an API that can’t be cached?” is the trick-probe. Scored answer: yes — termination/pooling kills handshake RTTs, HTTP/2/3 multiplexing helps chatty mobile clients, backbone routing shortens miss paths, compression cuts payload RTTs. Understanding WHY CDNs accelerate dynamic traffic separates candidates who think CDNs are just image caches.

My Private Notes

Notes are auto-saved locally to this device.