Handbooks / System Design / Chapter 2
Networking, DNS and CDNs
7 pages · ~5 min✓ Reviewed
Builds on How to Approach a System Design Interview. Next up: Scalability and Load Balancing.
DNS Resolution and Caching
1. Resolution Chain and Records
- Browser cache
- OS cache
- Resolvercaches answer
- Root
- TLD .com
- Authoritative
| Type | Holds |
|---|---|
A / AAAA | IPv4 / IPv6 address |
CNAME | alias to another name, not at zone apex |
MX | mail server |
TXT | verification, SPF |
NS | delegation |
2. TTL and Negative Caching
TCP vs UDP
1. Two Transports
| TCP | UDP | |
|---|---|---|
| Connection | connection-oriented | connectionless datagrams |
| Order | ordered | none |
| Loss | ACKs + retransmits | no retransmit |
| Handshake | SYN, SYN-ACK, ACK | none |
HTTP/1.1 vs HTTP/2 vs HTTP/3 and TLS Cost
1. Three HTTP versions
| HTTP/1.1 | HTTP/2 | HTTP/3 | |
|---|---|---|---|
| Format | text, keep-alive | binary frames, HPACK | binary frames |
| Transport | TCP | TCP | QUIC on UDP |
| Requests | 1 at a time, ~6 connections per host | many streams, 1 connection | independent streams |
Forward vs Reverse Proxies
1. Which Side It Hides
| Forward proxy | Reverse proxy | |
|---|---|---|
| Sits in front of | Clients | Servers |
| Hides | The client from the server | The servers from the client |
| Does | Egress filtering, anonymity, corporate caching | TLS termination, load balancing, caching, compression, rate limiting |
CDNs: Push vs Pull, Cache Keys, TTLs, Purging
1. Push vs Pull
| Pull | Push | |
|---|---|---|
| Fill | Edge fetches on first miss | You upload ahead |
| Effort | Low | You manage storage and sync |
| Catch | First request is slow | Best for large, rarely changing files |
2. Cache Key and TTL
Long Polling vs WebSockets vs SSE, and Cheat Sheet
1. Three Ways to Push
| Long polling | WebSocket | SSE | |
|---|---|---|---|
| Flow | hold request, re-request | 101 Upgrade, full-duplex | one-way server→client |
| Best for | fallback, any HTTP | chat, games, collab | feeds, notifications |
| Cost | request per event, latency | heartbeats, reconnect, sticky or pub/sub |
Check yourself
You change an A record with TTL 86400 and expect users to switch within a minute. What goes wrong?
- Caches may keep the old IP for up to 24 hours.
- Lower the TTL a full old-TTL ahead of the move, then change the record.
One packet is lost on a page loading 10 resources. Which stalls: HTTP/2 or HTTP/3?
- HTTP/2: all ten streams wait, because TCP holds every later byte.
- HTTP/3: only the stream that lost the packet waits.