Scrivio Interview library
DebuggingIntermediate7 min read · updated 13 November 2026

The home screen BFF calls 12 services in parallel. Each service has a p99 of 300 ms and a median of 40 ms, yet the BFF's p99 is above 900 ms, and one in ten home screen loads feels slow.

Explain why fan-out makes tail latency so much worse, and how you would bring the BFF's p99 down.

A fan-out response waits for the slowest of its 12 calls, and the chance that at least one call lands beyond its p99 is 1 - 0.99^12, about 11 percent, so each service's p99 becomes roughly the BFF's p89 and the BFF's p99 is set by the services' p99.9. We bring it down by giving every call a deadline from the screen's budget with partial responses for non-essential sections, hedging idempotent reads, reducing fan-out with caching, batching or precomputed read models, and measuring latency per dependency.

Why this question is asked

This puzzle surprises people because every service looks healthy on its own dashboard. A median of 40 ms and a p99 of 300 ms are good numbers, yet the screen built from them is slow for one user in ten. Interviewers ask it because the arithmetic behind it explains a whole class of production problems in microservice systems, and because the fixes show whether we think in budgets rather than averages. In this answer, we will recap what percentiles mean, work through the fan-out arithmetic, and then go through four ways to cut the tail: deadlines with partial responses, hedged requests, less fan-out, and per-dependency measurement.

1A Quick Recap of Percentiles

A percentile tells us how slow the slower requests are. A p99 of 300 ms means 99 percent of requests finish within 300 ms and 1 percent take longer. The median, or p50, is the middle request. The tail is the slow end of the distribution, the last few percent, and it is usually caused by things like garbage collection pauses, a cold cache, a busy database or a retransmitted network packet.

For a single call, 1 percent slow sounds rare. But a BFF, the backend for frontend that builds the home screen, does not make a single call. It makes 12 in parallel and cannot answer until all 12 are back. So the question becomes: how often is at least one of 12 calls in its own tail?

2Why Fan-Out Makes the Tail Worse

Each call has a 99 percent chance of finishing within 300 ms. If the calls are independent, the chance that all 12 do is 0.99 multiplied by itself 12 times.

Java
double allFast = Math.pow(0.99, 12); // 0.886: all 12 calls within their p99
double someSlow = 1 - allFast; // 0.114: at least one call beyond 300 ms
double allFast999 = Math.pow(0.999, 12); // 0.988
double someSlow999 = 1 - allFast999; // 0.012: about the BFF's p99 sits at the services' p99.9
Chance that at least one call is beyond the service p99
Calls per screenAll within p99At least one slow
199.0%1.0%
496.1%3.9%
1288.6%11.4%
3074.0%26.0%
The tail of one service becomes the body of the screen.

So about 11 percent of home screen loads include at least one call slower than 300 ms. That is exactly the one in ten slow loads users report: each service's p99 has become, roughly, the BFF's p89. And the BFF's own p99 is driven by calls at the services' p99.9, the slowest one in a thousand, which can easily be 900 ms or more. Notice that nothing is broken. The services did not get worse; we multiplied our exposure to their tails by 12.

This is why large systems talk about tail-tolerant design. The more services a request touches, the more the rare slow case becomes the common case, so we must design the BFF to stop depending on the slowest of everything.

3Fix 1: Deadlines and Partial Responses

The home screen has a budget, say 250 ms on the server. Each call gets a deadline taken from that budget. For calls that are essential, such as the user's profile, we wait or fail. For sections that are not essential, such as recommendations or a promotions carousel, a missed deadline means we return the screen without that section, or with cached or default content, and the app hides or fills it in.

Java
CompletableFuture<Recs> recs = recommendations.forUser(id)
.completeOnTimeout(Recs.fromCache(id), 150, TimeUnit.MILLISECONDS); // stale but fast
CompletableFuture<Promos> promos = promotions.forUser(id)
.completeOnTimeout(Promos.none(), 150, TimeUnit.MILLISECONDS); // section hidden
CompletableFuture<Profile> profile = profiles.get(id)
.orTimeout(250, TimeUnit.MILLISECONDS); // essential: fail if missing

Now a slow recommendations call costs 150 ms at most instead of 900. The trick is that the product team must agree which sections are optional; that is a product decision, not something the BFF team should guess. We should also pass the deadline downstream, for example in a header, so a service does not keep working on a request the BFF has already abandoned.

4Fix 2: Hedged Requests for Idempotent Reads

A hedged request sends a second copy of a slow call to another instance and uses whichever answer comes first. Most tail latency is caused by something local to one instance, like a GC pause, so the second instance is very likely to answer at normal speed. We wait until about the service's p95 before hedging, which means only about 5 percent of calls get a second copy, and we cancel the loser as soon as one answers.

This only works for idempotent reads, calls that can safely run twice. We never hedge a payment or an order creation. The cost is a few percent extra load on the service, and the reward is that the tail of each call is cut from p99.9 behaviour to something close to its p95.

Step throughA hedged read
BFFLoyalty instance 1Loyalty instance 2
GET balance
no answer after 80 ms (about p95)
same GET, the hedge
balance in 12 ms
cancel the first request
cancelled (it was stuck in a GC pause)

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

Only about 5 percent of calls are hedged, so the extra load stays small.

5Fix 3: Reduce the Fan-Out Itself

The best way to avoid the tail of 12 calls is to make fewer calls. Data that changes slowly, such as category names, store hours or feature banners, can be cached in the BFF for a minute or more, using a local cache like Caffeine or a shared Redis. Several calls to the same service can be merged into one batch endpoint. And parts of the screen that depend on many services can be precomputed into a read model, a table built ahead of time from events, so the BFF reads one row instead of calling five services.

Going from 12 calls to 5 changes the chance of hitting a tail from 11.4 percent to about 4.9 percent, before any other fix. So reducing fan-out and the per-call fixes multiply each other.

6Fix 4: Measure Latency Per Dependency

Finally, the BFF should record latency for every downstream call separately, as a Micrometer timer tagged with the dependency name, plus distributed tracing so a slow screen shows which call held it up. Often two or three services dominate the tail. Those get attention first: a cache, a hedge, a deadline or a conversation with the owning team about their p99.9.

Without this, the team sees one slow BFF and guesses. With it, the team can say that 70 percent of slow home screens wait on the promotions service, which turns a vague problem into a specific task.

7Follow-up questions

How do you keep hedged requests from doubling load during an incident?

We put a budget on them. A token bucket allows hedges for at most, say, 5 to 10 percent of requests to that dependency, so even if every call becomes slow, the extra load is capped at that share instead of 100 percent. We also stop hedging when the dependency's error rate or latency is high across all instances, because then the slowness is not local and a second copy only adds load, and we always cancel the losing request. Client libraries and service meshes that support hedging usually expose exactly these settings.

Are the 12 calls really independent?

Not always. If they share a database or a network path, their slow periods are correlated, which can make the real numbers better or worse than the simple formula. The formula is still the right first estimate and explains why the BFF tail is so much worse than any single service.

Why not just raise the timeouts?

Raising timeouts makes fewer requests fail but makes slow requests slower, so the user waits longer and the BFF holds more threads and connections. The goal is to stop waiting for the slowest call, not to wait for it more patiently.

8Conclusion

In this answer, we saw that a response waiting on 12 parallel calls hits at least one call's tail about 11 percent of the time, so each service's p99 becomes the BFF's p89 and the BFF's p99 depends on the services' p99.9. We cut the tail with deadlines and partial responses, hedged idempotent reads, fewer calls through caching, batching and read models, and per-dependency latency metrics that show where to start.

What to say in the interviewAbout 90 seconds aloud

Open with

The BFF waits for the slowest of its 12 calls. If each call has a 1 percent chance of being slower than its p99 of 300 milliseconds, the chance that at least one of 12 is slow is 1 minus 0.99 to the power 12, about 11 percent.

Then, if they want more

That matches the one in ten slow home screens, and it means each service's p99 has effectively become our p89, while the BFF's p99 is driven by the services' p99.9, which can be 900 milliseconds or more.

To fix it, I would first give every call a deadline from the screen's budget, and for non-essential sections like recommendations, return the screen with cached or default content when the call misses its deadline, which the product team has to agree to.

Second, for idempotent reads I would hedge: if a call has not answered by about its p95, send a second copy to another instance and cancel the loser, which costs a few percent extra load but cuts the tail a lot, with a hedge budget so it cannot double load in an incident.

Third, I would reduce the fan-out by caching slow-changing data, merging calls into batch endpoints and precomputing parts of the screen into a read model. And I would track latency per dependency so we can see which few services dominate the tail and start there.

About this answer

Last updated
13 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 "Explain why fan-out makes tail latency so much worse, and how you would bring the BFF's...": https://scrivio-interview-library.netlify.app/architecture/api-design-at-scale/a7b0bf4b49/