Quick revision
The short answer
Budgets start from the user-facing SLO of each journey and are allocated down the call graph, so each hop knows its share. Every service publishes its own latency SLO for its callers, a deadline travels with each request in a header so downstream services stop work nobody can use any more, adding a synchronous dependency to a critical path requires review, and SLO burn and per-hop percentiles are tracked centrally.
What to remember
In this answer, we saw that latency across eight services has to be governed from the user-facing SLOs downward. We allocate each journey's budget along its critical path, have each service publish its own SLO, propagate the remaining time in a header so downstream services skip work that can no longer be used, require review when a synchronous dependency is added to a critical path, and track SLO burn and per-hop percentiles centrally with tracing.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Budgets start from the user-facing SLO of each journey and are allocated down the call graph, so each hop knows its share. Every service publishes its own latency SLO for its callers, a deadline travels with each request in a header so downstream services stop work nobody can use any more, adding a synchronous dependency to a critical path requires review, and SLO burn and per-hop percentiles are tracked centrally.
Why this question is asked
When a user request passes through eight services, no single team can see the whole latency picture, and each one adds a few milliseconds that seem harmless on their own. Without governance, the end-to-end latency drifts upwards until the user-facing target is missed and nobody owns the problem. Interviewers ask this design question to see whether we can turn latency into something a platform manages rather than something teams discover in incidents. In this answer, we will recap SLOs and why latency adds up across hops, then design the allocation, published SLOs, deadline propagation, the review rule and the central tracking.
1A Quick Recap: SLOs and How Latency Adds Up
A service level objective, or SLO, is a target we commit to, such as '99 percent of search requests finish within 800 ms over 28 days'. The allowed failures, here 1 percent, are called the error budget. Burning it faster than planned is the signal that something is wrong.
Latency through a chain of services adds up, and the tail adds up worse than the average. If a request calls eight services in sequence, the chance that at least one of them is having a slow moment is much higher than for any single service. With fan-out it is worse still: a request that waits for ten parallel calls is as slow as the slowest of the ten. That is why per-service targets have to be derived from the end-to-end target, not chosen independently.
2Allocate Budgets Down the Call Graph
We start with the journeys users care about, such as search, product page and checkout, and their SLOs. For each journey we draw the call graph from traces and split the target along its critical path, the chain of calls that determines the total time. Each service gets a budget for its own work plus the budgets of the calls it makes, and we keep a margin at every level for queueing and pauses.
Parallel calls share one slot of the budget; sequential calls each need their own. This is where design choices show up as numbers: moving two sequential calls into parallel can free 100 ms for everyone else.
- Edge and gateway: 50 msTLS, routing, auth check
- Search API: 700 ms totalown work 80 ms, margin 70 ms
- Query service: 300 mscalls index 200 ms
- Ranking and availability in parallel: 200 msslowest of the two counts
- Pricing: 50 msserved from cache
5 layers, from the top down. Step through them one at a time.
Each level's budget includes the levels below it on the critical path.
3Each Service Publishes Its Own SLO
Allocation tells a service what its callers need; the published SLO is the service's promise back. Each service owner states, for its main endpoints, the latency at p99 it commits to and the error rate. We keep these in a catalogue, the same place that lists owners and on-call contacts, so a team designing a new caller can see that the availability service promises 150 ms at p99 before deciding to depend on it.
Published SLOs also make mismatches visible. If search needs availability in 120 ms and availability only promises 150 ms, the conversation happens at design time, with options such as a cache in front or a change to the budget, instead of after a missed target.
4Propagate a Deadline With Each Request
A deadline is the moment after which the user-facing request is useless. If the gateway gives up at 800 ms, any work a service deep in the graph does at 900 ms is wasted: it burns CPU and database time for an answer nobody will read, which makes overload worse. So we pass the remaining time downstream in a header, and every service checks it before starting expensive work and uses it to cap its own client timeouts.
We send the remaining time rather than an absolute timestamp, because clocks on different machines disagree by a few milliseconds or more. gRPC does this natively with its deadline mechanism; for HTTP, the platform starter provides a filter and a client interceptor so teams do not write it themselves.
The header name here is our own convention; what matters is that every service in the platform uses the same one, through shared code. Notice that the deadline does not replace client timeouts; each call still has a timeout, set to the smaller of its normal value and the time left.
5Review New Synchronous Dependencies on Critical Paths
Most latency regressions are not slow code but a new call. A team adds a synchronous call to a recommendation service from the product page, it costs 60 ms at p99, and the journey's budget is gone. So the governance rule is simple: adding a synchronous dependency to a budgeted critical path needs a review that shows where the time comes from.
The review is light. It asks whether the call can be asynchronous, cached or parallel to an existing call, and if it must be synchronous, which budget shrinks to pay for it. The aim is not to block teams but to make the trade-off explicit.
- Is the path budgeted (critical journey)?YesReview neededNoNormal change
- Can the call be async, cached or parallel?YesDo that, no budget changeNoFind the time
- Take the time from a budgetagreed with the owner of that budget
- Update allocation and the service catalogue
4 steps in order. Play them, or step through them one at a time.
6Track SLO Burn and Per-Hop Percentiles Centrally
Finally, the platform measures it all in one place. Each journey's SLO burn rate, how fast the error budget is being spent, drives alerts. Distributed tracing, for example with Micrometer Tracing and OpenTelemetry, gives per-hop latency, so a dashboard can show each service's p99 against its allocated budget.
When a journey starts burning its budget, the per-hop view shows which hop grew. A monthly review of journeys near their limit, with the owners present, keeps the allocation honest as the system changes.
7Follow-up questions
Why propagate remaining time instead of an absolute deadline?
Because clocks on different hosts are never perfectly in sync. An absolute deadline compared against a clock that runs 50 ms fast makes a service give up early. Remaining time only needs each host to measure elapsed time locally, which is reliable. The cost is that network time between hops is not subtracted, which is why each service also leaves a small margin.
What should a service do when the deadline has already passed?
Stop as early as possible and return an error such as 504 without calling anything else. It should not start database queries or downstream calls for a request that cannot be used. For writes, it must be careful: if part of the work is done, it should finish or roll back cleanly rather than stop half-way.
How do you handle a shared service used by many journeys with different budgets?
It publishes one SLO per important endpoint, and the tightest journey sets the bar. If one journey needs much tighter latency than the rest, we look at a dedicated cached endpoint for it rather than making the whole service meet the strictest target.
8Conclusion
In this answer, we saw that latency across eight services has to be governed from the user-facing SLOs downward. We allocate each journey's budget along its critical path, have each service publish its own SLO, propagate the remaining time in a header so downstream services skip work that can no longer be used, require review when a synchronous dependency is added to a critical path, and track SLO burn and per-hop percentiles centrally with tracing.
Open with
I would start from the user journeys and their SLOs, for example search at 800 ms p99, and allocate that down the critical path from traces, with parallel calls sharing a slot and a margin at every level.
Then, if they want more
Each service then publishes its own latency SLO per endpoint in the service catalogue, so callers can design against a promise and mismatches show up at design time.
At runtime I would propagate a deadline: the gateway sets the remaining time in a header, and the platform starter reads it, checks it before expensive work, and caps outgoing client timeouts with it, so services deep in the graph stop doing work nobody will use. I would send remaining time rather than a timestamp because of clock skew.
For governance, adding a synchronous dependency to a budgeted path needs a light review: can it be async, cached or parallel, and if not, whose budget pays for it. And centrally I would track SLO burn rate per journey and per-hop p99 against the allocation from distributed tracing, with a monthly review of journeys close to their limit.
That combination makes latency a managed resource instead of something we discover in incidents.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Define how latency budgets should be set and governed on a platform where user requests...": https://scrivio-interview-library.netlify.app/spring-boot/service-performance/1950c80064/