Where does the time go? A latency budget you can touch
Break a request into sequential stages, change their durations, and discover which wait deserves your attention.
A request finishes in 100 milliseconds. That number tells us how long we waited. It does not tell us where the time went.
A latency budget divides that wait into stages. In the simple model below, the request spends 20 ms reaching a service, 30 ms doing work, and 50 ms waiting for storage. Every value is illustrative: this is a model to explore, not a measurement of a running system.
Change one thing
Increase the storage duration. Then make the computation twice as fast. The chart shows how each change affects the total.
The largest section of the chart is a useful place to investigate. Saving 10 ms has the same effect on the total wherever it happens, but a large stage may offer more room for improvement.
Be explicit about the model
This calculator adds stages that happen one after another:
let total_ms = stages.iter().map(|stage| stage.duration_ms).sum::<f64>();Parallel work behaves differently. If two independent operations take 30 ms and 50 ms and start together, waiting for both takes approximately 50 ms, plus coordination overhead. Adding them would describe a different execution order.
Queues, retries, cache hits and network variation also need their own assumptions. A useful model makes those assumptions visible before presenting a precise-looking number.
Take the question back to the system
Start by measuring the stages of a real request. Preserve the distinction between the observed timings and the scenario you are testing. Then use a small model to ask what a change might achieve—and measure again after implementing it.