Browse patterns / Service architecture / B007
circuit breaker

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.

Recorded evidence 14/14Compare →Source
01 / UNDERSTAND

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.

02 / APPLY

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.

03 / VERIFY

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 threshold

learn.microsoft.com original ↗

Problem 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.

learn.microsoft.com original ↗

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' };

learn.microsoft.com original ↗

Data and asset placementEvidence available

Apply protection through centralized control at the gateway or edge.

Gateway-level breaker: centralized control at edge, protects ...

sreschool.com original ↗

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.

docs.aws.amazon.com original ↗

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)

www.cloudbees.com original ↗

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.

www.systemoverflow.com original ↗

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.

konghq.com original ↗

Cloud: development, deployment, and operationsEvidence available

Monitor breaker state and fallback behavior during managed Kubernetes upgrades in the cloud.

// Monitor circuit breaker state during upgrades

learn.microsoft.com original ↗

Kubernetes: 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.

piotrminkowski.com original ↗

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 alert

quality.arc42.org original ↗

BenefitsEvidence 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 element

www.sei.cmu.edu original ↗

Drawbacks 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.

shopify.engineering original ↗

Representative tools and technologiesEvidence available

Examples include Hystrix and Ribbon.

This example demonstrates how to use Hystrix circuit breaker and the Ribbon Load Balancing.

cloud.spring.io original ↗

Additional references (22)