The MeshCircuitBreaker policy does two separate jobs:
With connectionLimits, it caps connections, active requests, pending requests, and
concurrent retries at a proxy. Requests can wait for a connection up to the pending limit,
and anything beyond that is rejected.
With outlierDetection, it removes endpoints that fail more often than their peers from the
load balancing pool. Unlike MeshHealthCheck, it judges
endpoints from real traffic, not probes.
Both mechanisms work locally at each proxy, so callers don’t share limits or health
observations.
The following example limits the connections that proxies labeled app: web open to
backend. The limits are small to simplify testing, so size production limits for your
expected concurrency:
targetRef selects the proxies the limits apply to: Mesh, or Dataplane with labels.
to[].targetRef selects the destination to protect: Mesh, MeshService,
MeshExternalService, or MeshMultiZoneService. MeshHTTPRoute isn’t accepted, because
circuit breaking applies to a whole destination, not to one route.
connectionLimits sets the limits.
A policy needs to, rules, or both. Each default needs connectionLimits,
outlierDetection, or both.
connectionLimits accepts the following limits:
Limit
Caps
maxConnections
Connections to the destination.
maxPendingRequests
Requests waiting for a connection. For non-HTTP traffic, it acts as a connection limit.
maxRequests
Parallel requests. It has no effect on non-HTTP traffic.
maxRetries
Parallel retries across all requests to the destination. MeshRetrynumRetries caps attempts for one request, so set both to keep retries from amplifying a failure.
maxConnectionPools
Connection pools per cluster. Only relevant when a cluster creates many pools.
A new mesh has no MeshCircuitBreaker, so Envoy’s own limits apply: maxConnections,
maxPendingRequests, and maxRequests of 1024, maxRetries of 3, and no outlier detection.
outlierDetection temporarily removes failing endpoints from a proxy’s healthy pool.
Consecutive-failure detectors react to failures as they happen, and statistical detectors
evaluate each interval. baseEjectionTime sets how long an endpoint stays out, and repeated
ejections extend it. An endpoint that returns to the pool gets another attempt, which doesn’t
mean it has recovered.
The following example ejects backend endpoints after 10 consecutive failures:
maxEjectionPercent caps how much of the pool can be ejected at once, and defaults to 10%.
Envoy ejects an endpoint only if the ejected share, including that endpoint, stays within this
limit, and this policy doesn’t enable Envoy’s always_eject_one_host option. With the default
of 10%, a pool needs at least 10 endpoints before the proxy can eject any of them. Test the
limit with your actual endpoint count. For more information, see
Envoy’s outlier detection reference.
outlierDetection requires at least one detector. To turn the block off without deleting it,
set disabled: true. The block still needs a detector while disabled, but the detector is
ignored.
It returns consecutive server errors in a row: 5xx for HTTP, connection failures for TCP.
gatewayFailures
It returns consecutive gateway errors in a row (502, 503, or 504), including local failures such as timeouts or resets.
localOriginFailures
It has consecutive local failures in a row, such as timeouts, TCP resets, or ICMP errors. Requires splitExternalAndLocalErrors: true.
successRate
Its success rate is more than standardDeviationFactor below the cluster mean.
failurePercentage
Its failure rate is above a fixed threshold, regardless of its peers.
successRate and failurePercentage need enough traffic to be meaningful.
requestVolume sets the minimum requests an endpoint must see in an interval to be evaluated,
and minimumHosts sets how many endpoints must reach that volume before the detector runs.
If too few healthy endpoints remain, Envoy enters panic mode and sends traffic to all
endpoints, including ejected ones, instead of failing requests. healthyPanicThreshold sets
the percentage of healthy endpoints below which this happens, and defaults to 50%. Set it to
0 to disable panic mode. healthyPanicThreshold applies only while outlier detection is
enabled. When outlier detection is disabled, the 50% default applies.
rules applies to all inbound traffic at the selected proxies. It has no L7 matching, so use
a single catch-all entry.
Inbound limits apply to the connections between the destination proxy and its local
application, not across every replica. To limit one named inbound on a proxy with several
ports, set targetRef.sectionName.
A narrower policy overrides only the fields it sets. For example, setting only
maxConnections: 100 for web-to-backend traffic keeps the broader request and retry limits.
To turn off inherited outlier detection, set outlierDetection.disabled: true. The block still
needs a detectors entry, for example detectors: {totalFailures: {consecutive: 5}}, which is
ignored while disabled. Leaving the block out of the narrower policy doesn’t remove it.