What is the purpose of the circuit breaker pattern?
Circuit breaker: monitors calls to a remote service and, after a failure threshold is exceeded, "opens" the circuit, fast-failing subsequent calls without attempting them. This gives the failing service time to recover and prevents overload.
2 / 5
What are the three states of a circuit breaker?
States: Closed — requests flow normally; Open — circuit is open, requests fail immediately; Half-Open — a probe request is attempted to test if the service recovered; if it succeeds, the circuit closes, otherwise it re-opens.
3 / 5
What is a fallback in a circuit breaker implementation?
Fallback: instead of propagating an error, the circuit breaker can invoke a fallback function. This might return stale cached data, a sensible default, or a simplified response, providing degraded but not broken functionality.
4 / 5
How does a circuit breaker differ from a retry?
Retry vs circuit breaker: retries handle transient blips. When a service is down for minutes, retrying every request adds load to an already struggling system. The circuit breaker short-circuits calls entirely until recovery is detected.
5 / 5
What is the bulkhead pattern often used alongside circuit breakers?
Bulkhead: from ship design — separate compartments limit flood damage. In software, allocating separate thread/connection pools per downstream service ensures that one overwhelmed service does not starve resource pools for healthy services.