Skip to main content
Openfuse
Concepts

Circuit Breakers

How circuit breakers protect your system from cascading failures

A circuit breaker prevents your system from wasting resources on requests that will fail. When a downstream service starts failing, the breaker "trips" to block traffic and avoid turning a partial outage into a cascading one.

Three states

StateBehaviorWhen
ClosedTraffic flows normally. Every request reaches the downstream service.The service is healthy.
OpenTraffic is blocked immediately. Fallbacks run instead of real calls.The service is unhealthy or you tripped the breaker manually.
Half-OpenA limited number of probe requests test recovery.The breaker is checking whether the service has recovered.

State transitions

  1. Closed to Open: failure thresholds are met (automatic) or you flip the breaker from the dashboard.
  2. Open to Half-Open: after a retry timer expires, the breaker allows probe requests.
  3. Half-Open to Closed: probes succeed. The service is healthy again.
  4. Half-Open to Open: probes fail. The service is still down.

How Openfuse differs

Traditional circuit breakers run locally in each process. If you have 50 instances, you have 50 independent breakers that trip at different times, recover at different times, and can't be controlled.

Openfuse centralizes breaker state:

  • One source of truth: breaker state lives on the server, synced to all instances.
  • Dashboard control: open or close any breaker manually, instantly, across every server.
  • Consistent behavior: all instances see the same state within seconds.
  • Automatic thresholds: configure failure thresholds in the dashboard, not in code.

In your code, you use protect():

const customer = await openfuse.breaker('stripe-get-customer').protect(
  () => stripe.customers.retrieve(customerId),
  { fallback: () => cachedCustomer },
)

The SDK handles state checks, metrics, and sync. Thresholds and recovery are managed from the dashboard.

On this page