Retry Policies & Backoff

Explore exponential backoff schedules, jitter algorithms, retry ceilings, and manual replay controls.

Why Smart Retries Matter

Naively retrying failed requests at fixed intervals (e.g. every 5 seconds) causes the Thundering Herd Problem: if an API recovers after an outage, hundreds of queued retries hit it simultaneously, driving it back into a crash loop.

Bunnylynk uses mathematical backoff models with randomized jitter to space retries smoothly over time.

Backoff Algorithms

1. Full Jitter Exponential Backoff (Default)

The delay before attempt $n$ is calculated as:

$$ \text = \text(0, \min(M, B \times 2^n)) $$

Where:

  • $B$ is the initial base delay (default 5 seconds).
  • $M$ is the maximum backoff cap (default 3600 seconds / 1 hour).
  • $n$ is the zero-indexed retry count.
  • $\text(0, x)$ prevents synchronized requests across multiple failing connections.

2. Linear Backoff

For applications requiring predictable intervals:

$$ \text = \min(M, B \times n) $$

Example Retry Schedule

For a connection with base_delay = 10s, max_delay = 3600s, and max_retries = 8:

Attempt #Target Delay WindowWindow Duration
Attempt 1Immediate0s
Attempt 2~10s - 20s~15s
Attempt 3~20s - 40s~30s
Attempt 4~40s - 80s~1 min
Attempt 5~80s - 160s~2 min
Attempt 6~160s - 320s~4 min
Attempt 7~320s - 640s~8 min
Attempt 8~640s - 1280s~15 min

Manual Replay

At any time, you can trigger a manual replay for an event using the API:

curl -X POST https://api.bunnylynk.com/v1/events/evt_01JMWP3KV9QZ/replay \
  -H "Authorization: Bearer $BUNNYLYNK_API_KEY"

Next: Learn how Circuit Breakers protect your services.