Learn

VISUAL GUIDE · FOUNDATIONS & ESTIMATION

Follow a web request

Step 8 of 10: The next request reuses the connection

STEP 8 / 10ORIGINAL SKETCH
connect, GET /SQL queryHTMLBrowserMumbaiconnection still openDNS resolvercaches answersAuthoritativeDNSApp serverVirginiaDatabase!
A browser looks up a name through a DNS resolver, opens a connection to a distant app server that queries a database, and later goes through a nearby edge that keeps a warm connection to the server.

Where the time goesIllustrative · see assumptions

  • DNS, TCP, TLS (skipped)480 ms
  • Request travels100 ms
  • App code30 ms
  • Slow query400 ms
  • Response travels100 ms

Total ≈ 1110 ms

8 / 10
  1. Slow page
  2. DNS lookup
  3. TCP setup
  4. TLS setup
  5. Request sent
  6. Server work
  7. Response
  8. Reuse
  9. Nearby edge
  10. Fix the query

STEP 8 OF 10 · REUSE

The next request reuses the connection

When the shopper clicks to a second product a moment later, the browser still has the open, encrypted connection and a cached DNS answer. It skips DNS, TCP and TLS and sends the request straight away.

That removes about 480 ms. What remains is one round trip plus server work: about 630 ms, and the slow query is now most of it.

Why it matters. Keeping connections open (HTTP keep-alive, HTTP/2 multiplexing) is often the cheapest speed-up there is, but it only helps after the first request.