5 exercises on resilience patterns — circuit breakers, bulkheads, retry with backoff, jitter, and fallbacks.
0 / 5 completed
1 / 5
What does the circuit breaker pattern do?
Circuit breaker: states are CLOSED (normal), OPEN (failing — reject calls fast), and HALF-OPEN (probe with a few calls). Libraries like Resilience4j and Polly implement this. Fast-failing prevents resource exhaustion and cascading failures through a dependency chain.
2 / 5
What is the bulkhead pattern?
Bulkhead: named after ship compartments that prevent flooding from spreading. Giving each downstream service its own thread pool means a hung call to Service A fills its pool but leaves Service B's pool free. The calling service degrades gracefully instead of failing completely.
3 / 5
What is exponential backoff in retry logic?
Exponential backoff: the retry wait time grows exponentially, reducing the request rate against a struggling service. Without it, all retrying clients hammer the service simultaneously, worsening recovery — the thundering herd problem.
4 / 5
What does adding jitter to retry backoff accomplish?
Jitter: if 1000 clients all back off 4 seconds and retry simultaneously, the retry wave is as bad as the original spike. Adding random jitter (e.g. delay = random(0, base_delay)) staggers retries, smoothing load on the recovering service.
5 / 5
What is a fallback in resilience patterns?
Fallback: when a recommendations service is down, the product page can fall back to showing bestsellers instead of personalised suggestions. Users get a degraded but functional experience rather than an error page, improving perceived reliability.