What is Circuit Breaker?

Turkish: Circuit Breaker

The circuit breaker pattern stops calls to failing dependencies temporarily, preventing cascading failures and wasted resources.

What is a Circuit Breaker?

A circuit breaker is a resilience pattern that temporarily stops calls to a dependency when that dependency starts failing. It works like an electrical breaker: interrupt the flow before the failure spreads.

In the closed state, calls go through normally. If error rate or timeout count crosses a threshold, the circuit opens and new calls fail fast or return a fallback response. After a delay, the circuit becomes half-open and allows limited test calls. If they succeed, it closes; if they fail, it stays open.

Where Is It Used?

When a payment provider, shipping API, search service, or reporting database slows down, the calling system can exhaust threads, connection pools, and request queues. A circuit breaker limits this cascading failure.

It is not a complete reliability strategy by itself. Timeouts, retries, rate limits, bulkheads, monitoring, and meaningful fallback behavior should be designed together. Poor thresholds can either block a healthy dependency too often or notice a real outage too late.

Circuit breakers are common in microservice architectures. In API integrations, they help protect user experience when third-party systems degrade.