Try
↑ ↓ move↵ openesc close
In this lesson · topic 3 of 7
  1. 1. When a retry makes it worse
  2. 2. Backoff, jitter, budgets and breakers
  3. 3. Break a dependency and compare six retry policies
  4. 4. Jitter spreads retries, only budgets and breakers cap them
  5. 5. Hedging the slow tail
  6. 6. Deadlines down the chain, keys across the retry
  7. 7. Sizing the retry safety net

Topic 3

Break a dependency and compare six retry policies

7 min read

One incident, six policies

The lab starts in compare mode. The same new requests go to a copy of the dependency for each policy. After 40 ticks the dependency drops to 40 percent of its capacity for 40 ticks, then recovers. Three charts show what reaches the dependency, how many attempts succeed, and how many attempts each new request costs. The table under them gives the totals. Use the buttons above the charts to degrade the dependency at a moment of your choosing.

Predict before you press play

Which policy will still be failing most of its attempts 100 ticks after the dependency recovers?

tick 30healthy, incident not startedcapacity 10 per tick, 4 during the incident

The incident length and severity come from the sliders.
Attempts reaching the dependency, per tick
Attempts reaching the dependency, per tick. Text version available below the chart.05101520tick 1tick 16tick 30timeattempts per tick
Attempts that succeeded, last 20 ticks
Attempts that succeeded, last 20 ticks. Text version available below the chart.0%25%50%75%100%tick 1tick 16tick 30timesuccess rate
Attempts per new request, last 20 ticks
Attempts per new request, last 20 ticks. Text version available below the chart.0.00.51.01.52.0tick 1tick 16tick 30timeattempts per request

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

closedopenhalf-openhalf of recent attempts failafter 20 ticks3 probes passa probe fails
Breaker state over time

Outcomes by policy

Requests are counted by when they began. Peak load is the busiest 4 ticks in attempts per tick, and peak retry load counts only retries.
PolicyAttempts per requestBegan during incident, succeededBegan after, succeededPeak loadPeak retry loadWasted workRecovered after
No retry1.00x100%100%8.50.00not yet
Immediate retries1.00x100%100%8.50.00not yet
Exponential backoff1.00x100%100%8.50.00not yet
Backoff with full jitter1.00x100%100%8.50.00not yet
Jitter and a retry budget1.00x100%100%8.50.00not yet
Jitter and a circuit breaker1.00x100%100%8.50.00not yet

Full-page version with guided experiments: Retries and circuit breakers lab.

Push the incident around

  1. Press Pause during the incident and read the queue depth for each policy. Then let it run and watch which queues drain.
  2. Switch to the circuit breaker alone. Watch the state machine and the strip below it. How long does it stay open?
  3. Lower the capacity during the incident to 0, a full outage. How does the breaker behave when it probes and the dependency is still down?
  4. Set Clients waking at once to 80 and the new requests to 0.3. Compare exponential backoff with full jitter in the peak retry load column.
  5. Cut the attempts per request to 2. Is that enough to avoid the storm?
  6. Press Degrade the dependency now at a time you choose, then Recover it now a few ticks later. Which policies notice?

The full-page lab also has five guided experiments you can apply with one click.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms