THE PROBLEM
Trace one page load from a name lookup to the last byte, see where the time goes, and learn which fixes remove which delays.
A shopper in Mumbai opens a product page and waits more than a second before anything appears. The app server is in Virginia, and the team keeps arguing about whether to buy bigger servers. Before changing anything, follow one request from the browser to the database and back, and write down where the time actually goes.
By the end you can
- Name the stages of a first page load: name lookup, connection setup, request, server work, response.
- Explain why a distant server costs time on every round trip, not just once.
- Spot a slow database query as server time that no network fix can remove.
- Say what a reused connection and a nearby edge each remove, and what they leave behind.
- Sketch a timing breakdown that points at the right fix before you pick one.
Assumptions behind the numbers
- Illustrative: user in Mumbai, app server in Virginia, about 200 ms for one round trip between them. Real numbers vary; measure your own.
- Illustrative: the DNS resolver is close to the user (about 20 ms away) and needs about 60 ms more to ask the authoritative server on a cache miss.
- Illustrative: TCP needs one round trip and TLS 1.3 needs one more before the first request can be sent. Older TLS versions need two.
- Illustrative: app code takes about 30 ms and one unindexed query takes about 400 ms; with an index the same query takes about 15 ms.
- Illustrative: a nearby edge is about 10 ms round trip from the user, and first visits through the edge still pay the same 80 ms DNS lookup. Transfer time for the HTML itself is ignored to keep the arithmetic simple.