How the web works
Trace a browser request through DNS, TCP, TLS and HTTP, estimate connection setup, and choose a transport for real-time updates.
25 min8 steps
By the end you can
- Order DNS resolution, connection setup, TLS and an HTTPS request
- Estimate cold-connection latency from round-trip time and server work
- Explain how HTTP/2 and HTTP/3 differ when a packet is lost
- Choose SSE, WebSockets or polling for an update requirement
A URL becomes a request
Cold HTTPS over TCP: DNS, then TCP, then TLS, then HTTP. A warm browser skips stages.
Order a fresh HTTPS request over TCP, assuming DNS is not cached.
- 1Send the HTTP request and receive the response
- 2Negotiate TLS and authenticate the server
- 3Resolve the host name to an IP address
- 4Establish a TCP connection
DNS answers have a lifetime
The TTL says how long an answer may be cached. Changing it does not reach cached answers or open connections.
t0
Point name at new IP
t0 + TTL
Cached answers expire
Later
Old connections drain
Count the round trips before optimizing code
Cold path: 1 RTT TCP + 1 RTT TLS 1.3 + 1 RTT HTTP + server work. TLS 0-RTT data can be replayed.
- TCP setup60 ms
- TLS 1.3 handshake60 ms
- HTTP request60 ms
- Server work10 ms
Loading question…
Encryption does not decide permission
TLS proves who the server is and encrypts the wire. It does not decide whether this user may read order 42.
Multiplexing changes where requests wait
HTTP/1.1
- Many connections
- No browser pipelining
HTTP/2
- Streams on one TCP
- One loss stalls all
HTTP/3 (QUIC)
- Per-stream delivery
- Shared congestion control
A timeout does not mean nothing happened
A timeout does not mean nothing happened. GET is safe; PUT and DELETE are idempotent; POST is not.
Choose how updates reach the browser
Polling
- Simplest
- Seconds of delay
SSE
- One-way stream
- Built-in reconnect
- Use event IDs
WebSocket
- Two-way messages
- Chatty games, editors
Check your mastery
Estimate a cold budget, then say which terms vanish on a reused connection. Score 80% or more.
Mastery check
5 questions on fresh variants. One attempt each, no time limit. Score 80% or more to master the lesson.
Next: latency numbers.
Answer this step to continue.