Lab · Foundations

Request flow

Follow one request for a product page, part by part: DNS, a CDN edge near the user, and on a miss the origin far away. Pick which copies exist, then step forward and back and watch the time add up.

Try it

Where the address is known

The resolver answers from its copy: about 20 ms.

The CDN edge
The cache at the origin

With these settings: Answered by the database after 248 ms. The trip to the origin and back took 200 of those ms, so a CDN copy would have saved the most.

Browser, in PuneBrowserin Punewaiting for addressDNS resolver, name to address, NOWDNS resolvername to addressNOWCDN edge, in MumbaiCDN edgein MumbaiLoad balancer, origin, VirginiaLoad balancerorigin, VirginiaAPI gateway, checks each callAPI gatewaychecks each callProduct service, builds the answerProduct servicebuilds the answerCache, RedisCacheRedisDatabase, PostgreSQLDatabasePostgreSQL
  • Browser — in Pune — healthy — waiting for address
  • DNS resolver — name to address — healthy — NOW
  • CDN edge — in Mumbai — healthy
  • Load balancer — origin, Virginia — healthy
  • API gateway — checks each call — healthy
  • Product service — builds the answer — healthy
  • Cache — Redis — healthy
  • Database — PostgreSQL — healthy
  • Request
  • Answer
  • Miss: sent on
  • Read
  • Nothing found
  • Save a copy
Step 1 of 15

Step 1 of 15 · DNS resolver

Done: The browser asks DNS for the address

What happens
The browser has a name, shop.example.com, but the network needs an IP address.
Why
Nothing can be sent until the browser knows where to send it.
What changes
The resolver has a saved answer, so it can reply at once.
Next
DNS answers after 20 ms

Event log

14 more to go. Press a line to go back to that step.

Time so far
0ms
Lines crossed
1
Parts that did work
2
Answered by
not yet

Step 1 of 15: DNS resolver. The browser asks DNS for the address. The browser has a name, shop.example.com, but the network needs an IP address.

What this model simplifies
  • Every time here is an example value, not a measurement. The edge is 2 ms away and the origin 100 ms away each way. The cache takes 1 ms and the database 15 ms.
  • The connections are already open, so there is no TCP or TLS handshake to wait for. The HTTP lesson shows what those cost.
  • Each part does one thing at a time, and nothing fails. A real edge may also check with the origin before it serves an old copy.