Retries, exponential backoff, and jitter
We recover transient failures without repeating irreversible effects or multiplying demand. An uncertain outcome and a permanent rejection need different responses. We will classify failures, calculate backoff, spread retries, and give one layer a bounded retry budget.
#Section 13Which failures deserve a retry?
A malformed score correction will remain malformed after a delay. A connection interrupted before any command was sent may work on another attempt. A lost reply after commit is different again. A retry is another attempt to complete the same logical operation, and that identity is part of its safety.
Classify the outcome first. Validation or permission failures require a corrected request or changed permission. Transient transport failures may permit another attempt if the deadline and budget allow it. Uncertain writes require a stable command key and recovery of the original result, because blindly creating a new write can duplicate the effect.
For a command that adds a score delta, repeating the bytes is insufficient. The service must attach the same operation identity. A separate genuinely new correction uses a new identity even if its content is identical. Amazon’s idempotent API discussion motivates this distinction.
#Section 14Exponential backoff
Every failed request retries immediately, so a brief interruption produces another burst before the server recovers. Exponential backoff increases the delay ceiling between repeated attempts. It reduces repeated pressure and gives transient causes time to change, while a cap bounds an individual delay.
Read this as attempt index gets a ceiling equal to the smaller of maximum delay and initial delay doubled times. With illustrative initial delay 100 milliseconds and ceilings below the cap, the first values are 100, 200, 400, and 800 milliseconds.
The cap does not stop infinite attempts. Limit attempt count, overall time, and service-wide retry rate separately. A long-lived background task may have a different retry horizon from a viewer's interactive read. Store its progress so that a process restart does not reset all waiting work into an immediate burst.
#Section 15Jitter spreads the same recovery work
A fleet with identical delays retries together. Jitter is randomness added to retry timing so failures do not synchronize another surge. Under full jitter, choose a delay uniformly between zero and the current backoff ceiling.
Read this as the delay is uniform over the interval ending at ceiling , so its mean is half that ceiling. For ceilings 100, 200, 400, and 800 milliseconds, the means are 50, 100, 200, and 400 milliseconds. These are distribution means, not promised delays for individual callers.
Use an actual random source and keep the chosen delay within the remaining deadline. Do not describe jitter as fairness: a random short wait can favor one caller by chance. Admission policy supplies fairness; jitter reduces synchronized load. The Builders’ Library discusses these distinct controls.
#Section 16One retry owner and a retry budget
A gateway, application, and database wrapper each allow three attempts. One logical request can then become 3 times 3 times 3, or 27 database attempts. This multiplication is why a locally reasonable policy can create a globally unreasonable workload.
Give the layer with enough semantic knowledge ownership of retries. Lower layers should report failures promptly and expose whether work might have committed. An illustrative service-wide budget permits retry traffic of at most 10% of 1,000 original requests per second, or 100 retries per second. The attempt policy still limits each request separately.