Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

A checkout flow crosses 12 services and has an end-to-end p99 target of 800 ms. Set up performance budgets: how are they split, who owns them, and how are they enforced?

We split the 800 ms end-to-end p99 along the critical path that tracing shows, not evenly across all 12 services, and we hold back a margin for network hops and retries. Each service team owns its budget, including the latency of the dependencies it calls, and we measure p99 per service and end to end in production with distributed tracing. Performance tests in CI or staging catch regressions before release, any feature that adds a call to the critical path renegotiates the budget explicitly, and breaches go to the owning team through an agreed escalation path.

Why this question is asked

An end-to-end latency target means little if nobody owns the pieces. In a checkout that crosses twelve services, every team can honestly say its service is fast while the whole flow misses its target. Interviewers ask this at the staff level to see whether we can turn one business number into budgets that teams can act on, and build the measurement and process that keep it true over time. In this answer, we will find the critical path, split the budget along it, assign ownership, set up measurement in production and in tests, and agree how budgets change and how breaches are handled.

1Start From the Critical Path

The first mistake to avoid is dividing 800 ms by 12. Not every service sits on the path the user waits for. Some calls run in parallel, some are asynchronous, such as sending a confirmation email or publishing an analytics event, and some happen only for certain orders.

So we start with distributed tracing data from production, where each request carries a trace id and each service records a span for its work. Looking at many checkout traces, we can see which calls are sequential, which overlap, and which are off the user's path entirely. The critical path is the chain of sequential steps whose durations add up to the end-to-end time. Only that chain needs a share of the budget.

Step throughA simplified checkout critical path
GatewayCheckoutPricing / Cart / StockFraudPayment
POST /checkout
parallel: cart, pricing (+promo, tax), inventory
slowest of the three returns
fraud score
score
authorise payment
authorised
write order, publish OrderPlaced
201 Created

9 messages in order. Play them, or step through them one at a time.

Notifications and analytics consume OrderPlaced asynchronously and are off the critical path.

2Splitting the Budget

Now we assign each step on the critical path a p99 budget, guided by what it achieves today and what it fundamentally needs. Payment authorisation calls an external provider, so it needs the biggest share. The parallel group counts only once, at the budget of its slowest member. And we keep a margin, because network hops, TLS handshakes, occasional retries and queueing add time that no single service owns.

A p99 budget for an 800 ms checkout
Step on the critical pathp99 budgetNotes
Gateway and auth40 msTLS, routing, token check
Checkout service own work60 msvalidation, orchestration
Cart, pricing, inventory (parallel)120 mscounted once; pricing includes promo and tax
Fraud scoring100 msfallback rule if it times out
Payment authorisation200 msexternal provider
Order write and event publish80 mssingle transaction, outbox
Margin for network and retries200 msunassigned on purpose
Total800 mssum of sequential steps
The numbers are an example; the method is to split along the traced path and keep margin.

Two subtleties matter here. Percentiles do not add up exactly: the p99 of a sum is usually lower than the sum of the p99s, because it is unlikely that every step is at its worst at once. So summing per-step p99 budgets is conservative, which is what we want for a target. And retries must fit in the budget: if pricing may retry once, its budget must cover the retry, or the retry must be dropped.

3Who Owns Each Budget

A budget without an owner is a wish. Each team owns the p99 of its service as its callers see it, and that includes the time it spends waiting on its own dependencies. If pricing calls promotions and tax, pricing owns the 120 ms, and it negotiates sub-budgets with the promotions and tax teams. This keeps responsibility in one place: the checkout team does not need to understand tax internals, it holds pricing to its number.

Owning latency also means owning the tools to protect it. Each team sets timeouts on its outgoing calls that fit inside its own budget, so a slow dependency fails fast instead of consuming the whole end-to-end time. Propagating a deadline with the request, so each hop knows how much time is left, makes this consistent across the chain.

4Measuring in Production and Catching Regressions Early

In production, every service publishes latency histograms for its endpoints, and the edge measures the end-to-end checkout p99. Dashboards show each step against its budget, and alerts fire on SLO burn rate, meaning how quickly the latency objective is being used up, rather than on single slow requests. Tracing lets us open an example slow checkout and see exactly which step overspent.

Production data tells us after the fact. To catch problems before release, each team runs a performance test in CI or staging against a realistic data set, using an open-model load generator at a fixed rate, and fails the pipeline when p99 regresses beyond an agreed tolerance, for example 10 percent over the last accepted baseline. Staging numbers will not match production exactly, so we compare against a staging baseline, not against the production budget.

YAML
# Example CI gate (pseudo-config)
performance-test:
scenario: checkout-pricing
arrival-rate: 300/s for 5m
assert:
p99_ms: <= baseline.p99_ms * 1.10 # fail on a 10% regression
error_rate: < 0.1%

5Changing Budgets and Handling Breaches

Budgets are not fixed forever. Products change, and a new feature, say a loyalty points check, may want to add a call to the critical path. The rule is that this is never done silently. The team proposing the call brings its expected p99, and the owners of the end-to-end flow decide where the time comes from: from the margin, from another step that has improved, by running the new call in parallel or asynchronously, or by accepting a higher target with the product owner's agreement. The decision is recorded, for example in an architecture decision record, together with the updated budget table.

When a budget is breached, the alert goes to the owning team, not to a central performance team. We agree in advance what happens next: the team investigates within a set time, and if a service repeatedly breaches its budget and burns through its error budget, feature work on that service pauses in favour of reliability work, with escalation to engineering leadership if the problem persists. Agreeing this before the first breach turns a blame argument into a routine.

Step throughWhen a feature wants to add a call to checkout
  1. Team proposes the new callwith its expected p99
  2. Can it run off the critical path?
    YesMake it async or parallel; no budget changeNoRenegotiate the budget
  3. Is there margin or a step that improved?
    YesReassign that time, update the tableNoProduct decides: higher target or no call
  4. Record the decisionADR and updated budget table

4 steps in order. Play them, or step through them one at a time.

Budgets change explicitly, never silently.

6Follow-up questions

Why not give every service the same budget?

Because services do very different work and only some sit on the critical path. An even split would starve payment, which depends on an external provider, and waste budget on services that run in parallel or asynchronously. Splitting along the traced path matches budgets to reality.

What if a dependency outside our control, like the payment provider, is the problem?

We budget for it from measured data, protect ourselves with timeouts and, where the business allows, a fallback, and track it as a vendor SLO. If it consistently exceeds its share, that becomes a commercial or architectural discussion, such as a different provider or authorising asynchronously, rather than something another team can absorb.

How often should budgets be reviewed?

Whenever the critical path changes, and otherwise on a regular cadence such as quarterly, using fresh tracing data. Steps that consistently run far under budget can give time back to the margin or to new features.

7Conclusion

In this answer, we split the 800 ms p99 along the critical path that tracing reveals, counted parallel calls once, and kept a margin for network hops and retries. Each team owns its service's p99 including its dependencies, protected by timeouts and deadline propagation. We measured per service and end to end in production with tracing and burn-rate alerts, and caught regressions earlier with performance tests in CI or staging. New calls on the critical path renegotiate the budget explicitly, and breaches go to the owning team with an agreed escalation path.

What to say in the interviewAbout 100 seconds aloud

Open with

I would not divide 800 ms by twelve. First I would use distributed tracing from production to find the critical path, the sequential chain the user actually waits for.

Then, if they want more

Calls that run in parallel count once, at the slowest member, and asynchronous work like notifications and analytics gets no share. Then I would split the budget along that path based on what each step needs, giving the external payment call the biggest share, and I would deliberately keep a margin, maybe 200 ms, for network hops, TLS and retries.

Summing per-step p99s is conservative, which is fine for a target. Each team owns its service's p99 as its callers see it, including its own downstream calls, so pricing owns the time spent in promotions and tax and negotiates with them. Teams protect their budgets with timeouts that fit inside them, ideally with deadline propagation.

For enforcement, every service publishes latency histograms, the edge measures end-to-end p99, and we alert on SLO burn rate, with tracing to find which step overspent. Before release, teams run open-model performance tests in CI or staging and fail on a regression beyond, say, 10 percent of baseline.

If a feature wants to add a call to the critical path, that is an explicit decision: take time from the margin, make it async, or agree a new target with product, and record it. Breaches go to the owning team, with an escalation path agreed in advance.

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 documentation below. 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 "A checkout flow crosses 12 services and has an end-to-end p99 target of 800 ms. Set up...": https://scrivio-interview-library.netlify.app/java/java-performance/f603db3840/