Free tools

Exponential backoff calculator

See when each retry runs with exponential, linear or fixed backoff and jitter, how long until it gives up, and the code to use it.

Backoff

7 attempts in all. The last retry starts about 31m 30s after the first one fails.

Retry Wait Starts after the first failure Relative wait
1 30s 30s
2 1m 1m 30s
3 2m 3m 30s
4 4m 7m 30s
5 8m 15m 30s
6 16m 31m 30s

As Delay queue retry delays

Seconds, in order. Paste them into a queue's Retry delays.

30, 60, 120, 240, 480, 960

In your code

—

Runs in your browser. Nothing you type here is sent to a server.

Retries without writing the loop

Delay sends your HTTP requests as jobs and retries the ones that fail on the delays you give the queue, up to 10 of them. Jobs that still fail land in a dead letter queue you can replay, and every attempt keeps its response. Free for 1,000 requests a month.

Exponential backoff in short

When a request fails because the other side is down or overloaded, retrying right away usually fails again and adds to the load. Exponential backoff waits longer before each retry: 30 seconds, then 60, then 120, doubling each time. A short outage is covered by the first retries, and a long one isn't made worse by a steady stream of them.

A cap keeps the longest wait sensible, so the tenth retry doesn't wait eight hours. The number of retries sets when you give up, which is the question to start from: how long is the work still worth doing?

Why jitter matters

If a thousand clients fail at the same moment and all wait exactly 30 seconds, they all retry at the same moment too, and the service that was struggling gets the whole crowd again. Jitter adds randomness so the retries spread out.

Full jitter picks a wait anywhere from zero to the backoff, which spreads retries the most. Equal jitter keeps at least half of the backoff and randomises the rest. Decorrelated jitter picks each wait between the first delay and three times the last wait, so it grows without a fixed multiplier.

How Delay retries jobs

Each Delay queue has a list of up to 10 retry delays, each from 1 second to 24 hours, used in order. The default is 1 minute, 30 minutes and 3 hours. Each delay counts from the moment the previous attempt failed. There is no jitter, and a Retry-After header from your endpoint is ignored.

To back off exponentially, put growing delays in the list. The list under the table is the schedule above in that format, ready to paste. A job whose last attempt fails goes to the dead letter queue, where you can replay it. Crons don't retry: a failed run waits for the next scheduled one.

Questions

How many retries should I use?

Work back from how long the result is still useful. A request a user is waiting on might get 3 quick retries over a few seconds. A webhook or a nightly sync can retry over hours, so a provider's outage doesn't lose the work.

Which errors are worth retrying?

Timeouts, connection errors, 429 Too Many Requests and most 5xx responses, because they can pass. A 400, 401, 403, 404 or 422 will fail the same way every time until something is fixed, so retrying only adds load. The HTTP status codes page lists every code with a verdict.

What about the Retry-After header?

Some 429 and 503 responses say how long to wait, in seconds or as a date. When a client can read it, it should wait at least that long instead of its own backoff. Delay's queues don't read it and wait their configured delay.

Full jitter or equal jitter?

Full jitter spreads retries the most. In AWS's comparison of the two, it also did less work and finished sooner. Equal jitter never retries sooner than half the backoff, which is gentler on a service that needs time to recover.

Does Delay use exponential backoff?

Not by formula. Each queue retries on a list of up to 10 delays that you set, so you choose the exact schedule: growing delays give you exponential backoff, equal ones a fixed interval.

Schedule your first cron job

Free for 1,000 requests a month. No credit card.

Read the docs