Scrivio Interview library
ScenarioIntermediate6 min read · updated 13 November 2026

An API service runs 12 pods behind round robin. Most requests take 5 ms, but report requests take 2 to 4 seconds and arrive in bursts. During bursts, one or two pods reach 100 percent CPU and time out while others are idle.

Explain why round robin performs badly here and what you would change.

Round robin balances the number of requests, not the amount of work. A pod that happens to receive several 2 to 4 second reports in a burst is saturated, yet keeps receiving its equal share of new requests, which then time out, while other pods sit idle. I would switch to least outstanding requests or power of two choices, and better still separate reports into their own pool with a concurrency limit or make them asynchronous jobs, while watching per-pod CPU and in-flight requests rather than averages.

Why this question is asked

Mixed workloads are where simple load balancing breaks down. When nearly every request costs the same, round robin is close to perfect; when a few requests cost a thousand times more than the rest, it can leave one pod drowning while its neighbours idle. Interviewers ask this scenario to see whether we can explain the imbalance precisely and choose between a better algorithm and a better architecture. In this answer, we will see why round robin fails here with a small example, then improve it in three steps: a load-aware algorithm, separate pools for reports, and per-pod concurrency limits, and finish with the monitoring that makes imbalance visible.

1Why Round Robin Fails Here

Round robin gives each of the 12 pods every twelfth request. For 5 ms requests that is ideal. But a report takes 2 to 4 seconds of CPU, roughly 400 to 800 times the cost of a normal request. When a burst of reports arrives, which pods get them is a matter of where the round robin pointer happens to be, and some pods end up with several reports at once while others get none.

A pod running three reports has its CPU fully used. Round robin does not know that, so it keeps sending that pod one in twelve of all new requests. Those requests queue behind the reports, their 5 ms becomes seconds, and they time out. Meanwhile pods with no reports are idle. The averages look fine, perhaps 40 percent CPU across the fleet, while one or two pods fail.

Twelve pods during a report burst
PodsReports runningCPUFast requests
pods 3 and 83 each100 percenttime out, queued behind reports
pods 1, 5, 111 each60 percentslower
other 7 pods015 percent5 ms, mostly idle
Every pod received the same number of requests; the work was not equal.

2A Load-Aware Algorithm

Least outstanding requests sends each new request to the pod with the fewest requests in progress. A pod busy with reports has several requests outstanding for seconds, so new work naturally goes elsewhere. Power of two choices gets most of the same benefit cheaply: compare two random pods and pick the one with fewer outstanding requests, which works well when several balancer instances each see only part of the traffic.

This is a small change in most proxies, for example Envoy's least request policy, an ingress annotation, or Spring Cloud LoadBalancer with a custom chooser, and it immediately reduces the timeouts. But it does not stop a pod from accepting several reports at once, and fast requests still share CPU with reports on every pod, so it improves the problem rather than removing it.

3Separate the Workloads

The deeper fix is to stop mixing two very different workloads on the same pods. We route report requests, by path such as /reports, to their own deployment, a report pool, and leave the 5 ms requests on the main pool. Now a report burst can only slow other reports; the main API keeps its latency. Each pool can be sized and autoscaled for its own work, and the report pool can use larger CPU limits.

Even better, reports can become asynchronous jobs: the API accepts the request, puts a job on a queue, returns a job id, and workers generate the report and store it for download. Bursts then become queue length instead of overload, and the workers process them at a steady rate.

Step throughSeparated workloads
  1. Layer 7 proxyroutes /reports to the report pool, everything else to the API pool
  2. API pool (12 pods)5 ms requests, least outstanding requests
  3. Report pool or report workersown CPU limits, concurrency limit, scaled on queue or in-flight reports
  4. Shared data storesread replicas for reports where possible

4 layers, from the top down. Step through them one at a time.

4A Per-Pod Concurrency Limit for Reports

Whatever the routing, a pod should protect itself. A concurrency limit allows only a fixed number of reports to run at once on each pod, for example two on a 4-core pod, and rejects or briefly queues the rest. Rejected requests get a 503 with Retry-After, or the proxy retries them on another pod. The pod then never degrades every request it serves just because too many reports arrived.

Java
// Allow 2 concurrent reports per pod; others fail fast and are retried elsewhere
private final Semaphore reportSlots = new Semaphore(2);
@GetMapping("/reports/{id}")
ResponseEntity<Report> report(@PathVariable String id) throws InterruptedException {
if (!reportSlots.tryAcquire(200, TimeUnit.MILLISECONDS)) {
return ResponseEntity.status(503).header("Retry-After", "2").build(); // third report -> 503
}
try {
return ResponseEntity.ok(reports.build(id)); // 2 to 4 s of work
} finally {
reportSlots.release();
}
}

Notice that the limit is per pod, so it caps the damage locally, and that the release sits in finally so a failed report never leaks a slot. Libraries such as Resilience4j's bulkhead offer the same idea with metrics built in.

5Watching the Right Metrics

The fleet average hid this problem. We should graph CPU and in-flight requests per pod, and latency per pod and per route, so one pod at 100 percent stands out against eleven at 15 percent. Alerting on the maximum or the spread across pods, not just the mean, catches imbalance early. After the changes, the same graphs show whether the report pool and the API pool each behave evenly.

6Follow-up questions

What metric would you use to autoscale the report pool?

Not CPU averaged over the pool, which lags and hides saturated pods. If reports are synchronous, scale on in-flight reports per pod relative to the concurrency limit, for example add pods when average in-flight reports exceed 1.5 of the 2 allowed. If reports are asynchronous jobs, scale on queue depth or, better, estimated wait time: queue length divided by the rate at which workers finish reports, against a target such as 30 seconds.

Why not just add more pods to the main pool?

Because the imbalance is about distribution, not total capacity. With round robin, more pods only lowers the chance that one pod gets several reports, and the fast requests still share CPU with reports. Separating workloads fixes the cause at a lower cost.

Could the client help?

Yes. Report clients can be told to expect asynchronous results, and batch tools that request many reports at once can be throttled or given a separate API quota, which flattens the bursts that trigger the problem.

7Conclusion

In this answer, we saw that round robin balances request counts, so with 5 ms requests mixed with 2 to 4 second reports, pods that receive several reports saturate while still getting their share of new requests. We improve it with least outstanding requests or power of two choices, fix it properly by separating reports into their own pool or asynchronous jobs, protect each pod with a report concurrency limit, and watch per-pod metrics instead of averages.

What to say in the interviewAbout 80 seconds aloud

Open with

Round robin balances the number of requests, not the work they carry. Here a report costs hundreds of times more CPU than a normal request, so during a burst some pods happen to receive two or three reports and hit 100 percent CPU, but round robin keeps sending them their equal share of fast requests, which queue and time out while other pods are idle.

Then, if they want more

The fleet average looks fine, which is why it is easy to miss. As a quick improvement I would switch to least outstanding requests or power of two choices, so new work goes away from pods busy with long requests.

The real fix is to separate the workloads: route /reports to its own pool of pods with its own sizing and autoscaling, or better, turn reports into asynchronous jobs on a queue so bursts become a longer queue instead of overload.

On every pod that runs reports, I would add a concurrency limit, for example two reports at once with a semaphore or a Resilience4j bulkhead, returning 503 with Retry-After beyond that. And I would monitor CPU and in-flight requests per pod and alert on the maximum, not the average.

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 round robin performs badly here and what you would change.": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/3a2c3f8c12/