Learn

VISUAL GUIDE · FOUNDATIONS & ESTIMATION

Follow a web request

Step 6 of 10: The server builds the page, and waits on a query

STEP 6 / 10ORIGINAL SKETCH
connect, GET /SQL queryBrowserMumbaiDNS resolvercaches answersAuthoritativeDNSApp serverVirginiaDatabase!no index, ~400 ms
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 lookup80 ms
  • TCP handshake200 ms
  • TLS handshake200 ms
  • Request travels100 ms
  • App code30 ms
  • Slow query400 ms

Total ≈ 1010 ms

6 / 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 6 OF 10 · SERVER WORK

The server builds the page, and waits on a query

The app code parses the request, checks the session and renders a template in about 30 ms. To fill in the product details it runs a SQL query.

That query filters on a column with no index, so the database scans far more rows than it returns. It takes about 400 ms, longer than any single network leg.

This is the delay no CDN or connection trick can remove for a personalised page. It needs an index, a cheaper query, or a cached result.

Why it matters. Server time is often hiding inside "the network is slow". One slow query can cost more than a trip across the ocean.