SOLID & Design Patterns Interview Question #91
What is the difference between Retry and Circuit Breaker?
DDD Boundaries, Resilience, Caching & Practical ASP.NET Core Design Mid-Level Intermediate
Quick Interview Answer
Retry assumes a failure may be temporary and repeats the operation. Circuit Breaker detects sustained failure and temporarily prevents additional calls.
Detailed Explanation
Retry assumes a failure may be temporary and repeats the operation. Circuit Breaker detects sustained failure and temporarily prevents additional calls.
They are often combined carefully: a small retry policy can handle brief transient errors, while a circuit breaker protects the application when the dependency remains unhealthy. Excessive retries can amplify an outage.
Code Example
Request
|
Retry (limited)
|
Circuit Breaker
|
Remote Service