What it is
The request lifecycle is everything between "the browser wants a URL" and "the response has arrived": resolving the name, opening and securing a connection, sending the request through every proxy between the user and the data, doing the work, and carrying the answer back. It is the classic "what happens when you type a URL" question, and the clearest way to see where latency comes from.
Why it exists
HTTP is a request/response protocol on top of a reliable, encrypted byte stream. That stream does not exist until both sides set it up, and setting it up takes round trips. Behind the public address there are usually several layers (CDN, load balancer, app servers, databases), each added for a reason: caching, spreading load, isolating failures. Each one adds hops. Knowing the lifecycle tells you which costs are fixed per connection, which are per request, and which depend on load.
How it works
- DNS lookup. The browser resolves the hostname. From caches this costs nothing or one short round trip to the resolver; cold it can cost 100 ms or more. CDNs answer with the address of a nearby edge.
- TCP handshake. SYN, SYN-ACK, ACK. The client may send data right after its ACK, so a new connection costs one round trip.
- TLS handshake. With TLS 1.3, the ClientHello carries a key share, the server answers with its ServerHello, certificate and Finished, and the client can send the request with its Finished: one round trip (TLS 1.2 needed two). A resumed session can send 0-RTT early data, but that data can be replayed, so it is only safe for idempotent requests.
- The request.
GET /productstravels to the edge. If the edge has a fresh cached copy it answers immediately. Otherwise it forwards the request over a warm, long-lived connection to the origin, where a load balancer (or reverse proxy) picks an app server. The app server runs the handler, which queries the database, renders a response, and sends it back along the same path. - The response and the connection afterwards. The connection stays open (keep-alive, the default since HTTP/1.1), so the next request skips steps 1–3. HTTP/1.1 sends one request at a time per connection, so browsers open about six connections per host. HTTP/2 multiplexes many concurrent requests as streams over one TCP connection. HTTP/3 runs over QUIC on UDP: the transport and TLS handshakes are combined into one round trip, and a lost packet only stalls its own stream rather than every request on the connection (TCP head-of-line blocking).
A worked example from the lesson, with the user 10 ms from the edge and the origin 35 ms beyond it: DNS 20 ms + TCP 20 ms + TLS 20 ms of setup, then about 120 ms for the request (20 ms to the edge and back, 70 ms edge to origin and back, about 5 ms in the load balancer and internal hops, about 25 ms of app work including a 5 ms query). Without the edge, the two handshakes would go to the origin, 90 ms away per round trip: 180 ms instead of 40.
When to use it
Use the lifecycle as a checklist whenever latency matters: designing a public API, choosing between regions, deciding what to cache at the edge, planning a page's critical requests, or explaining a slow time to first byte. In interviews it is the backbone for any "how does a request reach your service" discussion.
When not to
Do not optimise by guesswork from the diagram. Measure: browser waterfalls, server timing headers and distributed traces show which step actually dominates. And not every system has every layer. An internal service-to-service call usually skips DNS (cached), TLS setup (long-lived pooled connections) and the CDN entirely.
Trade-offs
| Choice | You gain | You pay |
|---|---|---|
| CDN edge in front of dynamic traffic | Handshakes near users, warm origin connections, edge caching | Another layer to configure, cache invalidation, cost |
| Long-lived connections and pooling | No setup per request | Memory and file descriptors per connection; balancing long-lived connections is harder |
| HTTP/2 | Many requests on one connection, header compression | One lost TCP packet stalls every stream |
| HTTP/3 (QUIC) | 1-RTT setup, no TCP head-of-line blocking, connection migration | UDP blocked on some networks (fallback needed), more CPU in user space |
| TLS 1.3 0-RTT | Saves a round trip on resumed connections | Replay risk; only for idempotent requests |
Alternatives
- Fewer requests: bundling, inlining critical resources, or a single API call that returns everything a screen needs (a backend for frontend) removes round trips altogether.
- Edge compute: run the handler at the edge so dynamic responses avoid the trip to the origin; the data must then be replicated or cached near the edge.
- Preconnect and DNS prefetch hints: the browser starts DNS, TCP and TLS before the request is needed.
- Long-lived channels (WebSockets, server-sent events) for many small messages, so setup is paid once.
Failure modes
- Redirect chains: every redirect is another full round trip, sometimes to a new host with its own DNS, TCP and TLS.
- Connection churn: clients or proxies that close connections after every request pay full setup each time and can exhaust ephemeral ports.
- Cold caches after a deploy or purge: edge misses send every request across the long distance to the origin at once.
- Queueing under load: near capacity, waiting for a free worker or database connection dominates latency; timeouts and retries can then amplify the load.
- Slow handshakes: expensive certificate chains, OCSP checks or a far-away TLS terminator add to every new connection.
In production
Terminate TLS at the edge or the closest load balancer, keep connections to backends pooled and warm, enable HTTP/2 and HTTP/3, and cache everything that can be cached at the edge. Watch time to first byte broken down by phase (browser Navigation Timing and server timing headers), and trace requests through each hop so you can see which layer adds latency. Keep enough capacity headroom that requests do not queue at peak.
Common misconceptions
- "Bandwidth makes the web fast." For typical requests, the number of round trips and the distance matter far more than bandwidth.
- "An extra proxy hop always makes things slower." A nearby edge that terminates TCP and TLS usually makes first requests much faster.
- "HTTP/2 makes every request faster." It removes waiting in line on the client side; on lossy networks a single TCP connection can be worse, which is what HTTP/3 addresses.
- "Server time is what users wait for." At light load it is often a minority of the total.
Interview angle
Walk through DNS, TCP, TLS and the request path in order, naming the round trips and putting rough numbers on them. Then show you know where to cut: CDN edges, connection reuse, HTTP/2 and HTTP/3, caching, fewer round trips. Mentioning TLS 1.3's one round trip, 0-RTT's replay caveat and TCP head-of-line blocking shows depth; connecting latency under load to queueing shows systems thinking.
Model assumptions
The lesson mixes two kinds of animation. The DNS lookup, TCP and TLS handshakes, the no-reuse and keep-alive comparisons and the HTTP/2 example are scripted: hand-placed packets with illustrative timings (10 ms one way to the edge, 1 ms processing per hop). The engine does not model TCP, TLS, packet loss or congestion control. The request path (browser → CDN edge → load balancer → app servers → database) is simulated by the queueing engine: 35 ms one way from edge to origin, an edge that forwards every request (no edge caching in the simulation) with about 1 ms of work, two app servers with 2 workers and a 20 ms mean service time each (lognormal, cv 0.4) that also wait for a 5 ms database query, round-robin balancing. Arrivals are evenly spaced at first and random (Poisson) from the "Under load" step on. Numbers show behaviour and orders of magnitude, not benchmarks.