Frequent questions about retries: how many, how long, idempotency, circuit breaker.
- How many retries?
3-5 attempts with exponential backoff. More than that is usually a design smell.
- How long should the backoff be?
Base 100-500ms, doubling each attempt, with jitter. Cap at 30s.
- What is idempotency?
The property that repeating the operation has the same effect.
PUTis idempotent;POSTis not, unless it uses an idempotency key.- Retry vs circuit breaker?
A retry reattempts; a circuit breaker stops after N failures to protect the target. Use both.