Skip to content
Optimal Lab

System design · interactive

The journey of a request

Typing a URL and hitting enter touches DNS, a CDN, load balancers, app servers, caches and databases. Each hop costs time, and caching removes whole stretches of the trip. Times are illustrative.

  1. DNS lookupResolver walks to the authoritative server40 ms
  2. TCP + TLS to CDN edgeTwo round trips to a nearby edge30 ms
  3. CDN edgeMiss: forward to the origin2 ms
  4. Edge → origin load balancerLong-haul to the region70 ms
  5. App serverRender, call services15 ms
  6. Cache (Redis)Miss1 ms
  7. DatabaseQuery on the primary25 ms
  8. Response back to the userReturn trip, then the browser renders80 ms

total ≈ 263 ms

First visit pays for everything: DNS, new connections, the long trip to the origin, a cache miss and a database query.

Scenario

Step 1 of 4

  1. 1

    Find and connect

    DNS turns the name into an IP; TCP and TLS handshakes open a secure connection, a round trip or two each.

    Reused on later requests.

  2. 2

    CDN edge close to the user

    Static files and cacheable pages are served right there. Everything else is forwarded to your region.

    Distance is the biggest cost.

  3. 3

    Load balancer, app, cache, database

    The app checks the cache first and only queries the database on a miss.

    Each layer exists to skip the next.

  4. 4

    Optimise the longest hops

    Cut round trips and distance before micro-optimising code. Measure with traces across the whole path.

    See the other sessions on each hop.

In production

Tools and technologies

Tracing tools show the whole path of a request.

Not tied to one language — use these names when you search docs or design a system.