Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Circuit Breaking in the Mesh
HLD

Circuit Breaking in the Mesh

Connection-pool and request-level breaking as policy — outlier ejection vs true circuit breakers.

Two Mechanisms, One Goal

 meshes offer related-but-distinct protections:

 1. OUTLIER EJECTION (per-endpoint health):
    consistently-failing ENDPOINT benched from the pool.
    (load-balancing lesson's passive health.)

 2. CIRCUIT BREAKING (capacity protection):
    limits on CONCURRENT demand toward a cluster;
    excess rejected FAST instead of queueing into doom.

 [sidecar]──► cluster: reviews
   maxConnections: 100      ← tcp pool cap
   maxPendingRequests: 50   ← queue cap
   maxRequests: 200         ← in-flight cap (http2)
   maxRetries: 30           ← retry storm ceiling

 caps hit → immediate local failure response → caller falls
 back. the dependency is shielded from stampedes; callers
 degrade fast instead of hanging slow.

What Mesh Breaking Does NOT Do

 classic breaker semantics (open→cooldown→probe) are NOT
 the default mesh behavior — know what you configured:

 mesh caps = LOAD SHEDDING at concurrency boundaries.
 they prevent resource exhaustion; they don't auto-open/close
 on error RATES by themselves.

 error-rate-driven behavior comes from:
 - outlier ejection (removes bad endpoints progressively)
 - your own app/mesh-policy layering (retry budgets +
   fallback routes on errors)

 practical stack for a sick dependency:
   ejection benches dying instances ✓
   concurrency caps prevent stampede ✓
   retry budget prevents multiplication ✓
   route fallback serves cached/default ✓
 four policies composing = the real circuit breaker.

Configuring Without Footguns

KnobGuidance
maxConnections≈ peak concurrent × headroom per instance
maxPendingRequestssmall! queues hide sickness
maxRetriesfleet % budget; tiny relative to traffic
ejection base timestart 30s; escalate on repeat
 sizing sins seen in production:
 ✗ pending-queues of thousands (latency bombs)
 ✗ caps sized from CPU math ignoring downstream DB pools
 ✗ no per-cluster differentiation: one global config for
   both the auth service and the batch exporter
 ✗ forgetting HTTP/2 multiplexes requests over fewer
   connections → maxConnections nearly irrelevant there;
   maxRequests is the live knob

Interview Framing

“Configure protection so a degrading reviews service can’t take down checkout” scored shape: distinguish ejection-vs-concurrency-caps explicitly (the common conflation), show the four-policy composition stack, HTTP/2 knob subtlety named, queue-small principle stated with reasoning. The question tests whether you configure meshes from FAILURE MODELS or copied YAML — explain why each number exists.

My Private Notes

Notes are auto-saved locally to this device.