Scrivio Interview library
ScenarioIntermediate6 min read · updated 13 November 2026

One of 15 instances of a service has a corrupted local cache and returns HTTP 500 for about 30 percent of requests. Its /health endpoint returns 200, so it stays in rotation, and the service's error rate has sat at 2 percent for six hours.

How do you get the balancer to remove this instance automatically, and what are the risks of doing so?

This is a gray failure: the instance is partly broken but passes a simple probe, so active health checks will never remove it. We turn on passive outlier detection at the proxy, for example Envoy's success-rate or failure-percentage ejection, which compares each host with its peers and ejects the outlier for a growing period. The risks are ejecting healthy hosts during a shared problem, so we cap the ejected share, count only failures that point at the host, and alert so the root cause is fixed rather than hidden.

Why this question is asked

A service running at a steady 2 percent error rate for six hours often goes unnoticed, because nothing looks down. Yet one instance is failing almost a third of its requests, and every user routed to it has a bad experience. Interviewers ask this to see whether we know the limits of health checks and how to automate removal without creating a bigger outage. In this answer, we will name the failure, see why the probe misses it, configure outlier detection, then look at the risks and the guard rails that control them.

1A Quick Recap: What a Gray Failure Is

A health check probe tests one narrow path, often GET /health, which returns 200 if the process is alive. A gray failure is a state where the instance is alive and answers that probe correctly but fails some of its real work. Here, a corrupted local cache makes about 30 percent of real requests on one instance end in HTTP 500, while /health never touches that cache.

The numbers explain why it hides so well. With 15 instances and even balancing, the bad one handles one fifteenth of the traffic, about 6.7 percent. Thirty percent of that is 2 percent of all requests, which is exactly the service-level error rate we see. A 2 percent error rate rarely trips a page, so the problem sits there for hours.

2Why Active Checks Will Not Catch It

We could try to make /health smarter, for example by reading a sample from the cache. But we would be guessing which part might break next time, and every new check makes the probe heavier. The more general answer is that the best health signal is the real traffic itself. The proxy in front of the instances already sees every response, so it can notice that one host answers much worse than the others. That is passive health checking, known in Envoy as outlier detection.

3Configuring Outlier Detection

Envoy offers several detectors. Consecutive 5xx ejects a host after a run of errors, five by default. With a 30 percent error rate, five in a row is not frequent, about 0.24 percent of windows, but at hundreds of requests per second it still happens often. A better fit is success-rate ejection: every interval, Envoy computes each host's success rate, compares it with the mean and standard deviation across hosts, and ejects any host far below the rest. Failure-percentage ejection is simpler: eject any host whose failure rate exceeds a fixed threshold, given enough requests.

YAML
outlier_detection:
interval: 10s # evaluate every 10 seconds
consecutive_5xx: 5 # quick reaction to a host that fails hard
success_rate_minimum_hosts: 5 # need at least 5 hosts to compare
success_rate_request_volume: 100 # and 100 requests per host in the interval
success_rate_stdev_factor: 1900 # eject below mean - 1.9 x stdev
failure_percentage_threshold: 20 # or any host failing more than 20 percent
enforcing_failure_percentage: 100 # this detector is off (0) by default
failure_percentage_request_volume: 50
base_ejection_time: 30s # 30 s, then 60 s, 90 s... on repeat ejections
max_ejection_percent: 10 # never eject more than 10 percent of hosts
Step throughWhat outlier detection decides every interval
  1. Collect per-host results5xx and connection errors
  2. Enough hosts and requests?
    YesCompare hostsNoDo nothing this round
  3. Host far below its peers?
    YesCheck the ejection capNoLeave it in rotation
  4. Below max ejection percent?
    YesEject for base time x countNoLeave it in, raise an alert
  5. Ejection time overhost returns, watched again

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

Ejection is relative to the other hosts, so a problem shared by all of them does not single out anyone.

With these settings, the bad instance at 70 percent success stands far below 14 peers near 100 percent, so it is ejected within one or two intervals. After 30 seconds it is allowed back; if it fails again, the next ejection lasts longer, because the ejection time is multiplied by the number of times the host has been ejected. A persistently broken host therefore spends most of its time out of rotation.

4The Risks of Automatic Ejection

The first risk is ejecting healthy hosts when the problem is shared. If a downstream database fails, every host returns 500s. Success-rate ejection is relative, so it does not single anyone out, but consecutive 5xx would happily eject host after host. This is why max ejection percent exists. Envoy's default of 10 percent means that in a pool of 15 at most one host is ejected at a time, so a shared problem cannot empty the pool.

The second risk is counting the wrong failures. A 404 or a 400 is the client's mistake and says nothing about the host. A 503 caused by a dependency that is down for everyone is not the host's fault either. We should count 5xx responses and connection failures, and if our services return a specific status or header when a downstream is failing, exclude those. Envoy can also separate locally originated errors such as connection resets from upstream responses, which helps.

The third risk is that ejection hides the problem. The service error rate drops from 2 percent to almost zero, everyone is happy, and the corrupted cache stays. So we must alert on ejections and on per-instance error rates, and treat repeated ejection as a signal to act, for example by letting automation terminate and replace an instance that has been ejected three times in an hour.

5Follow-up questions

How would client-side retries change what users see during the six hours?

If the client or the proxy retries a failed idempotent request on a different host, most users never see the 500: the first attempt fails on the bad instance, the retry lands on a good one, and the response is just slower. That hides the gray failure even better, so the error rate on dashboards drops while load rises by the retried requests. Retries are useful, but they need a retry budget, a retry on a different host, and metrics on retry counts per upstream host, otherwise we lose the very signal that would have exposed the bad instance.

Why compare hosts with each other instead of using a fixed error threshold?

A fixed threshold has to be set above normal error rates, which vary by service and time of day, so it either misses moderate failures or fires during normal noise. Comparing with peers adapts automatically: a host is suspicious when it is much worse than hosts doing the same work at the same moment. It also protects against shared failures, because when all hosts are bad, none of them stands out.

Could the cache corruption be fixed at the instance itself?

Yes, and it should be, once we find the cause. A cache can validate entries, for example with checksums, and drop the cache when validation fails. Outlier detection is the safety net that limits user impact while the real fix is found.

6Conclusion

In this answer, we saw that a partly broken instance passing its probe is a gray failure, invisible to active checks and hidden in a 2 percent error rate. Outlier detection at the proxy, especially success-rate or failure-percentage ejection, removes it automatically with growing ejection times. The guard rails are a cap on ejected hosts, counting only host-specific failures, and alerting plus automated replacement so the problem is fixed instead of hidden.

What to say in the interviewAbout 90 seconds aloud

Open with

This is a gray failure: the instance passes its health probe but fails about 30 percent of real requests, and because it is one of 15 instances, that shows up as only a 2 percent error rate overall.

Then, if they want more

Active checks will not catch it because the probe never touches the broken cache. So I would turn on passive outlier detection at the proxy, in Envoy for example.

Consecutive 5xx catches hard failures, but for this I prefer success-rate ejection, which compares each host's success rate with its peers and ejects the outlier, or failure-percentage ejection with a threshold like 20 percent. Ejection lasts 30 seconds the first time and grows with each repeat, so a persistently bad host stays out.

The risks: if a shared dependency fails, every host errors, and a naive detector could eject them all, so I keep max ejection percent at about 10 percent. I count only 5xx and connection errors, not 4xx or errors caused by a downstream outage that affects everyone.

And ejection hides the problem, so I alert on ejections and per-instance error rates, and let automation replace an instance that keeps getting ejected. Finally, if clients retry on another host, users see slower responses rather than errors, which is good for them but makes metrics on retries per host even more important.

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 "How do you get the balancer to remove this instance automatically, and what are the...": https://scrivio-interview-library.netlify.app/architecture/load-balancing-networking/62566d7fc3/