How a request travels
From a tap on a phone to a row in a database and back, in about 200 milliseconds.
What you will be able to do
- Trace a single request through every hop it touches
- Explain what DNS, TLS, and connection reuse cost in round trips
- Identify which layer to look at when a request is slow
- Describe a design round answer that starts with the path, not the boxes
The chain, in order
Someone types a URL or taps a button. Before an application server sees anything, several things happen, and each one can be the reason a page feels slow.
Where the milliseconds actually go
Read that table as a budget. If a page takes 900 ms and the database query takes 4 ms, the database is not your problem. If a service calls five peers in sequence across two regions, the network is the design.
Fan-out is where latency compounds
One service call is cheap. Ten sequential calls are not, because each waits for the last. The two fixes are structural: call independent dependencies in parallel, and move anything the user is not waiting for out of the request path into a queue.
Sequential: 40 + 40 + 40 + 40 + 40 = 200 ms Parallel: max(40, 40, 40, 40, 40) = 40 ms Async: return 40 ms, do the rest after responding
A page that loads in 200 ms from five parallel calls will feel better than one that loads in 300 ms from three sequential ones. When you are asked to make something faster, count the hops before you touch the database.
Stateless services make the path repeatable
If any server can serve any request, the balancer is free to send traffic anywhere, restarts are invisible, and scaling is adding identical boxes. Sessions belong in a shared store or a signed token, not in process memory. The moment one request must return to the same machine, you have created a scaling problem and an availability problem at the same time.
- Keep request handlers stateless; push state to a cache, a database, or the client.
- Make every hop observable: a request id that travels with the call is what makes a slow request traceable later.
- Terminate TLS at the edge so your services speak plain HTTP inside a trusted network.
- Set timeouts and budgets per hop, not just per request, or one slow dependency becomes your whole latency.
Worth remembering
- A request is a chain of hops; the total latency is the sum of each hop's work plus network time.
- Connection setup, TLS handshake, and DNS are one-time-ish costs that connection pooling and caching hide.
- The first thing to ask about a slow path is where the time is spent, not which database to swap.
- Explaining a request path out loud is the cheapest way to prove you understand the system you just drew.