SOLID & Design Patterns Interview Question #90

What is the Circuit Breaker Pattern?

DDD Boundaries, Resilience, Caching & Practical ASP.NET Core Design Mid-Level Intermediate

Quick Interview Answer

The Circuit Breaker Pattern temporarily stops calls to a repeatedly failing dependency. After a failure threshold, the circuit opens and fails fast instead of continuing to overload the unavailable service.

Detailed Explanation

The Circuit Breaker Pattern temporarily stops calls to a repeatedly failing dependency. After a failure threshold, the circuit opens and fails fast instead of continuing to overload the unavailable service.

After a waiting period, a limited trial can determine whether the dependency has recovered. Circuit breakers complement retries but solve a different problem: preventing repeated calls to an unhealthy dependency.

Code Example

Closed    -> requests flow normally
Open      -> fail fast
Half-Open -> allow limited trial requests

Success -> Closed
Failure -> Open again