Classic interview question. Everyone gets the basics. DNS, TCP, HTTP. Ask for details and they fall apart.
You type google.com. Browser needs an IP address.
1. Browser cache — got it recently?
2. OS cache — system resolved it before?
3. Router cache — anyone on network asked?
4. ISP DNS — recursive resolver
5. Root DNS → TLD DNS → Authoritative DNS
This takes 20-120ms. Or 0ms if cached.
Here's what people miss: DNS uses UDP, not TCP. No handshake. Fire and forget. That's why it's fast but also why DNS spoofing exists.
Got the IP. Now we connect.
Client → SYN
Server → SYN-ACK
Client → ACK
Three packets before any data moves. 50ms to a server in another continent means 150ms just to establish connection.
This is why CDNs exist. Server closer = less RTT = faster handshake.
HTTPS means another handshake. TLS 1.3 made this faster—one round trip instead of two. Saves 100ms+ on every new connection.
Server processes. Could be instant for cached content. Could be 500ms if it's hitting a database.
HTML arrives. Browser starts parsing.
HTML → DOM tree
CSS → CSSOM tree
DOM + CSSOM → Render tree
Render tree → Layout → Paint
Parser hits a <script> tag? Stops. Downloads JS. Executes. Then continues. That's why script position matters. That's why async and defer exist.
DNS: 50ms
TCP: 50ms
TLS: 50ms
Server: 200ms
Download: 100ms
Parse/Render: 150ms
-----------------
Total: 600ms
Half is network. Quarter is server. Quarter is browser.
Optimize the wrong layer and you waste effort. SSR won't help if your images aren't compressed. CDN won't help if your server takes 2 seconds.
2 seconds. 14 steps. Dozens of ways to screw it up.
— blanho
You have 10 million saved searches. A new item comes in. How do you find all matches without running 10 million queries?
The hidden state in your servers is why you can't just 'add more boxes'.
That abstraction layer you're building? You don't need it yet.
GET / HTTP/2
Host: google.com
Accept: text/html