Retries and circuit breakers lab
Degrade a dependency at a chosen moment and watch six client policies react. Compare how many attempts each sends, how much load the dependency sees and whether it ever recovers.
tick 30healthy, incident not startedcapacity 10 per tick, 4 during the incident
| Series | Latest | Lowest | Highest |
|---|---|---|---|
| Capacity | 10 | 10 | 10 |
| No retry | 5 | 1 | 11 |
| Immediate retries | 5 | 1 | 11 |
| Exponential backoff | 5 | 1 | 11 |
| Backoff with full jitter | 5 | 1 | 11 |
| Jitter and a retry budget | 5 | 1 | 11 |
| Jitter and a circuit breaker | 5 | 1 | 11 |
Events: incident starts at tick 41; incident ends at tick 81.
| Series | Latest | Lowest | Highest |
|---|---|---|---|
| No retry | 100% | 100% | 100% |
| Immediate retries | 100% | 100% | 100% |
| Exponential backoff | 100% | 100% | 100% |
| Backoff with full jitter | 100% | 100% | 100% |
| Jitter and a retry budget | 100% | 100% | 100% |
| Jitter and a circuit breaker | 100% | 100% | 100% |
Events: incident starts at tick 41; incident ends at tick 81.
| Series | Latest | Lowest | Highest |
|---|---|---|---|
| No retry | 1.0 | 1.0 | 1.0 |
| Immediate retries | 1.0 | 1.0 | 1.0 |
| Exponential backoff | 1.0 | 1.0 | 1.0 |
| Backoff with full jitter | 1.0 | 1.0 | 1.0 |
| Jitter and a retry budget | 1.0 | 1.0 | 1.0 |
| Jitter and a circuit breaker | 1.0 | 1.0 | 1.0 |
Events: incident starts at tick 41; incident ends at tick 81.
No retry
- attempts per request
- 1.00x
- attempts succeeding
- 100%
- waiting at dependency
- 5
Immediate retries
- attempts per request
- 1.00x
- attempts succeeding
- 100%
- waiting at dependency
- 5
Exponential backoff
- attempts per request
- 1.00x
- attempts succeeding
- 100%
- waiting at dependency
- 5
Backoff with full jitter
- attempts per request
- 1.00x
- attempts succeeding
- 100%
- waiting at dependency
- 5
Jitter and a retry budget
- attempts per request
- 1.00x
- attempts succeeding
- 100%
- waiting at dependency
- 5
Retry budget: 10.0 tokens left.
Jitter and a circuit breaker
- attempts per request
- 1.00x
- attempts succeeding
- 100%
- waiting at dependency
- 5
Breaker is closed. It has opened 0 times.
Circuit breaker, live
Outcomes by policy
| Policy | Attempts per request | Began during incident, succeeded | Began after, succeeded | Peak load | Peak retry load | Wasted work | Recovered after |
|---|---|---|---|---|---|---|---|
| No retry | 1.00x | 100% | 100% | 8.5 | 0.0 | 0 | not yet |
| Immediate retries | 1.00x | 100% | 100% | 8.5 | 0.0 | 0 | not yet |
| Exponential backoff | 1.00x | 100% | 100% | 8.5 | 0.0 | 0 | not yet |
| Backoff with full jitter | 1.00x | 100% | 100% | 8.5 | 0.0 | 0 | not yet |
| Jitter and a retry budget | 1.00x | 100% | 100% | 8.5 | 0.0 | 0 | not yet |
| Jitter and a circuit breaker | 1.00x | 100% | 100% | 8.5 | 0.0 | 0 | not yet |
- No retry: 1.00x attempts per request overall, 1.00x now, 100% of attempts succeeding now, 5 waiting at the dependency, peak load 8.5 per tick.
- Immediate retries: 1.00x attempts per request overall, 1.00x now, 100% of attempts succeeding now, 5 waiting at the dependency, peak load 8.5 per tick.
- Exponential backoff: 1.00x attempts per request overall, 1.00x now, 100% of attempts succeeding now, 5 waiting at the dependency, peak load 8.5 per tick.
- Backoff with full jitter: 1.00x attempts per request overall, 1.00x now, 100% of attempts succeeding now, 5 waiting at the dependency, peak load 8.5 per tick.
- Jitter and a retry budget: 1.00x attempts per request overall, 1.00x now, 100% of attempts succeeding now, 5 waiting at the dependency, peak load 8.5 per tick.
- Jitter and a circuit breaker: 1.00x attempts per request overall, 1.00x now, 100% of attempts succeeding now, 5 waiting at the dependency, peak load 8.5 per tick, breaker closed, opened 0 times.
What to try
Each one sets up a starting point. Then make the change it describes.
A short incident becomes a long one
Keep the defaults and compare all six. Watch the dependency load chart and the success chart for Immediate retries.
Look for. With no retries the dependency recovers soon after the incident ends. With immediate retries the dependency stays buried long after it is healthy, because the retries keep its queue full and every answer comes too late.
Jitter is not a cure
Compare Immediate retries, Exponential backoff and Backoff with full jitter in the table. Look at attempts per request and whether each recovers.
Look for. Backoff and jitter spread retries out and lower the peak load. They do not lower the total, so the dependency can still stay overloaded. Limiting the number of retries is what ends the storm.
A budget and a breaker
Pick Jitter and a retry budget, then Jitter and a circuit breaker, one at a time.
Look for. The budget caps retries at a tenth of the new requests, so the dependency sees little extra load. The breaker opens during the incident, sends nothing while open, then probes and closes. Both recover. The breaker does it fastest, and it fails more requests while it is open.
Clients that wake at once
Set clients waking at once to 80, lower the new requests to 0.3, and compare Immediate retries, Exponential backoff and Backoff with full jitter. Read the peak retry load column.
Look for. All the woken clients fail together, so plain backoff makes them retry together, wave after wave. Full jitter gives each client its own delay and flattens the peaks.
A lighter load
Drop the new requests to 0.3 so the degraded dependency can still keep up, and compare all six.
Look for. Nothing fails, so no policy has anything to do. Retries and breakers only change the outcome when the dependency is overloaded.
New to the idea? Read the lesson first. Every number here comes from a seeded simulator, so the same seed gives the same run.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms