.NET Architecture & System Design Interview Question #129
What is the Circuit Breaker pattern?
Resilience, Rate Limiting, Health Checks & Observability Senior Advanced
Quick Interview Answer
The Circuit Breaker pattern temporarily stops calls to a dependency after failures exceed a configured threshold. Instead of repeatedly waiting for a known-unhealthy service, calls fail quickly or use an appropriate fallback.
Detailed Explanation
The Circuit Breaker pattern temporarily stops calls to a dependency after failures exceed a configured threshold. Instead of repeatedly waiting for a known-unhealthy service, calls fail quickly or use an appropriate fallback.
After a recovery period, limited test calls can determine whether the dependency has recovered. Circuit breakers protect both the caller and the failing downstream system.
Code Example
Closed -> calls allowed
|
failure threshold reached
v
Open -> fail fast
|
recovery interval
v
Half-Open -> test calls
|
success -> Closed