Circuit breaker
A pattern that temporarily blocks access to a remote service or resource once failures pass a threshold, to avoid repeated failures and retries.
Structure and behavior
Follow the arrows step by step.
After repeated failures, the breaker blocks calls and allows a limited trial to check recovery.
Expected benefits
Limits the impact of outages and reduces resources wasted retrying a failed service.
Trade-offs
A threshold set too low increases false opens during brief blips.
Not suitable where a high baseline error rate is expected, such as input validation.
Operations and adoption guide
Synthesis, distinct from items backed by source excerpts. Validate before applying in production.
When to use
Use this pattern when remote microservice calls keep timing out or returning 5xx errors. Block calls for a while, then move to Half-open and test whether the dependency has recovered.
Scenario
A large e-commerce order API calls inventory, payment, and notification services synchronously. If payment latency spikes, threads or connections can be exhausted and all orders can fail. Put a breaker on payment calls: when the error rate exceeds the threshold, fall back promptly; in Half-open, allow a limited number of requests to check recovery. The requirements are protecting the order success rate, containing the failure, and surfacing alerts and dashboards for operators.
Placement principles
- Centralize protection at a gateway or edge
- Place it in a service mesh or sidecar proxy alongside routing, observability, and policy
- Embed it at the call site using a client library
- For multiple clusters or regions, coordinate the state with a distributed coordinator backed by shared storage.
On premises
Deploy the service mesh or API gateway to on-premises Kubernetes or VMs. Tune each dependency’s threshold, timeout, and fallback to fit the environment. Standardize centralized configuration delivery and the observability stack first.
Cloud
Implement it with managed Kubernetes, service mesh, or gateway policies. Monitor breaker state and fallback behavior during rollouts and upgrades, and integrate with managed metrics, alerts, and autoscaling.
Kubernetes
Use OutlierDetection in Istio DestinationRule, a mesh circuit-breaker policy, or a library such as Hystrix, Resilience4j, or opossum. Manage thresholds and reset timeouts through ConfigMap or CRDs, and watch state transitions during pod or node drains and rollouts.
Incident response
Typical incidents include a spike in dependency latency or errors, a false open, failed recovery in Half-open, a failed fallback, or an open with no alert. Use alerts and metrics to check breaker state and the dependency’s SLO, then inspect thresholds, timeouts, fallbacks, and recent deployments. If necessary, manually open the circuit, route around it, or distribute traffic. After mitigation, verify Half-open recovery and tune settings to prevent recurrence.
Evidence by criterion (14 total)
Evidence availability at the time of research. Assess source accuracy and currency separately.
Definition and overviewEvidence available
A pattern that temporarily blocks access to a remote service or resource once failures pass a threshold, to avoid repeated failures and retries.
Temporarily block access to a remote service or resource after failures reach a thresholdProblem addressedEvidence available
Limits cascading failures caused by temporary outages, overload, latency, or timeouts in distributed remote calls.
In a distributed environment, calls to remote resources and services can fail because of transient faults.Key components and resourcesEvidence available
Options include a timeout, an error threshold (%), a reset timeout, and fallback behavior.
const options = { timeout: 3000, errorThresholdPercentage: 50, resetTimeout: 30000, fallback: () => 'Service temporarily unavailable' };Data and asset placementEvidence available
Apply protection through centralized control at the gateway or edge.
Gateway-level breaker: centralized control at edge, protects ...Typical use casesEvidence available
Block repeated timeouts or errors in microservice calls and detect when the dependency recovers.
When multiple microservices collaborate to handle requests, one or more services might become unavailable or exhibit high latency.Example scenarioEvidence available
Stop pipeline logging calls when an observability dashboard or connector goes down.
Pipelines interact with dashboards, like Sumo Logic or ELK Stack to log key performance indicators (KPIs)When to avoid and caveatsEvidence available
Not suitable where a high baseline error rate is expected, such as input validation.
User input validation services may reject `30%` of requests. A circuit breaker would stay permanently open.On premises: development, deployment, and operationsEvidence available
On premises, run the breaker in a service mesh or gateway for container or VM workloads.
Deploy Kong Mesh anywhere: on Kubernetes, in the cloud, on-premises, with containers or on virtual machines.Cloud: development, deployment, and operationsEvidence available
Monitor breaker state and fallback behavior during managed Kubernetes upgrades in the cloud.
// Monitor circuit breaker state during upgradesKubernetes: development, deployment, and operationsEvidence available
In Kubernetes, use mechanisms such as OutlierDetection in an Istio DestinationRule.
For configuring a circuit breaker in Istio we are using `OutlierDetection` object.Incident responseEvidence available
Silent opens and failing fallbacks delay detection. Track state transitions, alert on them, and check dependency health.
Silent trips: The breaker stays “Open” and serves degraded responses for an extended period while emitting no state-transition metric or alertBenefitsEvidence available
Limits the impact of outages and reduces resources wasted retrying a failed service.
The benefit of this pattern is that it limits the consequences of a failure by wrapping the interface to that elementDrawbacks and trade-offsEvidence available
A threshold set too low increases false opens during brief blips.
The lower the `error_threshold`, the higher the probability of a false-positive circuit open.Representative tools and technologiesEvidence available
Examples include Hystrix and Ribbon.
This example demonstrates how to use Hystrix circuit breaker and the Ribbon Load Balancing.Additional references (22)
- Circuit Breaker Pattern - Azure Architecture Center | Microsoft Learn ↗
- Circuit breaker pattern - AWS Prescriptive Guidance ↗
- What is Circuit breaker? Meaning, Architecture, Examples, Use Cases, and How to Measure It (2026 Guide) - SRE School ↗
- Circuit Breaker: How to Keep One Failure from Taking Down Everything ↗
- Implementing the Circuit Breaker pattern - .NET | Microsoft Learn ↗
- The Circuit Breaker Pattern - Dos and Don'ts — AKF Partners ↗
- docs/operations/failurehandling.md ↗
- Tactics and Patterns for Software Robustness | CMU Software Engineering Institute ↗
- Dynamic configuration management and circuit breakers in Kubernetes - rastko ↗
- Azure Kubernetes Service (AKS) production upgrade strategies - Azure Kubernetes Service | Microsoft Learn ↗
- ECS vs Kubernetes: Paying for Portability Up Front ↗
- Istio and mTLS — securing and observing your service mesh ↗
- Kong Mesh: Enterprise Service Mesh for Kubernetes | Kong Inc. ↗
- Kubernetes Circuit Breaker & Load Balancer Example ↗
- Circuit breaker and retries on Kubernetes with Istio and Spring Boot ↗
- Zero-Downtime Migration to Azure Kubernetes Service (AKS) - Azure Kubernetes Service | Microsoft Learn ↗
- Your Circuit Breaker is Misconfigured - Shopify ↗
- Circuit Breaker | arc42 Quality Model ↗
- Circuit Breaker Policy Fine-tuning Best Practice - .NET Blog ↗
- Circuit Breaker Trade Offs: When Not to Use Them ↗
- Learn Trade-Offs and Limitations of Circuit Breakers | Designing Resilient Architectures ↗
- Google SRE - Troubleshooting Methodology: A Learning Path ↗