advanced24 min studyLesson 374 in Engineering

Outlier ejection: remove a bad destination without losing the fleet

Separate passive observations, active health, ejection limits, and the capacity consequences of a shrinking eligible endpoint set.

On this page

What you’ll understand

  • Distinguish passive failures from active checks and discovery membership.
  • Explain why an endpoint's observed errors may depend on the observing proxy.
  • Calculate remaining capacity after a hypothetical ejection policy.

An outlier detector uses observed traffic outcomes to identify destinations that should temporarily receive less or no traffic. The decision is local to a defined observer and policy scope. Removing an unhealthy endpoint can improve success probability, but it also concentrates demand on the remaining set. Detection thresholds and ejection limits must protect both correctness of diagnosis and usable capacity.

Define the observation before choosing a threshold

Passive detection sees failures generated by actual traffic, such as upstream error responses, connection failures, resets, or timeouts. Active health checking sends its own probes. Discovery membership says that an endpoint is advertised, while Kubernetes readiness reports another configured condition. These signals can disagree legitimately: a health URL may succeed while an authenticated application route fails, or a network partition can affect only one source zone. Record the request path and observer before labeling an endpoint globally unhealthy.

Envoy v1.40.0 distinguishes locally originated connection-related errors from externally originated upstream errors when configured to split those categories. A timeout at the proxy is different evidence from an application returning HTTP 500. Protocol handling also matters: a TCP proxy cannot infer arbitrary application error semantics it does not parse. A threshold on consecutive failures reacts differently from a windowed failure percentage, and low-volume hosts may not provide enough samples for a statistical detector. Specify minimum sample conditions and what resets a consecutive counter.

p^fail=fn,n>0\widehat{p}_{\rm fail}=\frac{f}{n},\qquad n>0
f is the count of classified failures among n observed attempts for one defined host, observer, and interval. The ratio is an empirical fraction, not a causal diagnosis or a guarantee about future requests. n=0 provides no failure-rate estimate.↔ Scroll wide equations horizontally.

Ejection changes the eligible capacity

Ejection generally marks a host unavailable to a particular proxy's ordinary load-balancing set for a configured period. Other proxies may have different observations and decisions. A cluster can also be shared across routes, so excluding one endpoint can affect traffic whose own requests did not produce the failures. Envoy provides enforcement settings, maximum ejection controls, and interactions with active health checking. Its panic behavior can also change whether unhealthy hosts are selected. Do not present ejection as an unconditional network-wide ban that every route and proxy immediately obeys.

A policy limiting how many hosts may be ejected prevents one detector from casually eliminating the entire service, but it can also leave some unhealthy hosts selectable. The exact percentage rounding, minimum-host behavior, and recovery rules are implementation-specific. Evaluate endpoint capacities rather than counts alone: losing one large endpoint may remove more capacity than losing several small ones. Recovery should consider whether returning hosts can handle full traffic immediately, whether active probes exercise the failing path, and whether repeated ejections reveal a shared dependency rather than independent bad machines.

μremain=∑i∈Eeligibleμi,ρ=λμremain\mu_{\rm remain}=\sum_{i\in E_{\rm eligible}}\mu_i,\qquad \rho=\frac{\lambda}{\mu_{\rm remain}}
μ_i are assumed independent sustainable endpoint capacities in requests per second, λ is offered requests per second, and ρ is a simplified offered-load ratio. Shared bottlenecks, unequal routing, retries, and stochastic headroom are excluded. Positive remaining capacity is required.↔ Scroll wide equations horizontally.

Validate the consequences of a removal

Test one failing endpoint, a zone-local connectivity failure, a shared upstream outage, and insufficient remaining capacity. Observe why a host was detected, whether enforcement actually ejected it, and how request outcomes changed afterward. A falling error count at the ejected host can simply mean it receives no traffic, not that its underlying failure recovered. Track successful completed work and latency across the surviving set. Include the possibility that aggressive ejection and client retries create a cascade by overwhelming otherwise healthy endpoints.

The probability lab illustrates sample count only. Reset, set p=0.10 and n=20, predict two failures on average and variance 1.8, then Play or Step. Separately Reset, set p=0.50 and n=20, predict ten failures on average, then Play or Step. These are exact independent binomial probabilities with a fixed stipulated failure rate. They do not run a consecutive-error detector, eject hosts, or model correlated outages. Explain why twenty quiet observations cannot prove that a rarely used authenticated route works, and why the observed failure category must remain explicit.

Check capacity after a permitted ejection

A fictional service has ten equal endpoints, each sustaining 100 requests/s. Offered demand is 900 requests/s. A teaching policy permits at most two simultaneous ejections, and both occur. Ignore retries and shared bottlenecks.

  1. Before ejection, total modeled capacity is 10×100=1,000 requests/s, with offered-load ratio 900/1,000=0.9.

  2. After two endpoints are excluded, capacity is 8×100=800 requests/s. Demand exceeds it by 100 requests/s; with uniform routing each remaining endpoint receives 112.5 requests/s.

  3. The ejection may remove genuine failures, but the surviving set cannot sustain this demand under the stated capacities. Reduce offered load, add working capacity, or change the operational response rather than assuming removal alone solves the incident.

The result

An ejection limit constrains one policy action; it does not prove the remaining endpoints have enough capacity. The chosen two-host limit is hypothetical, not Envoy percentage-rounding behavior.

Explore the model

Interactive lab

Interactive lab · probability

Failure evidence depends on sample assumptions

Reset, set p=0.10 and n=20, predict mean 2 and variance 1.8 failures, then Play or Step. Separately Reset, set p=0.50 and n=20, predict mean 10, then Play or Step. The exact binomial model has no ejection policy, health probes, or correlated-failure mechanism.

Failure evidence depends on sample assumptionsThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA detector needs a defined failure signal and enough relevant observations; exclusion then needs a separate capacity check.

Check your understanding

Why does an endpoint's error count falling to zero after ejection not prove recovery?

Try it yourself

Five eligible endpoints have capacities 50,50,100,100,200 requests/s. Eject the 200-request/s endpoint and compare remaining capacity with 350 requests/s demand.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Sum capacities rather than assuming losing one of five removes exactly twenty percent of capacity.

Compare with the solution

Initial capacity is 500 requests/s. Removing the largest endpoint leaves 300, a forty-percent capacity reduction despite removing only twenty percent of the endpoint count. Demand 350 exceeds remaining capacity by 50 requests/s under the model, before retries or imbalance. A count-based ejection limit alone cannot express that resource difference.

Take it with you

  • Passive failures, active probes, readiness, and discovery are different signals.
  • Ejection is scoped policy with implementation-specific enforcement and recovery.
  • Removing bad endpoints still requires enough surviving capacity and controlled demand.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.