Skip to content
IT glossary
BackendUpdated December 3, 2026

Retries

Повторы запросов

When a request fails temporarily or no reply arrives in time, the client can try the same operation again. It usually waits before resending and limits how many attempts it makes.

Also known as: exponential backoff, ретраи

What a retry does

Suppose a checkout service asks an inventory API whether an item is in stock. The API returns 503 Service Unavailable while restarting. A second request a short time later might succeed, so the shopper never sees the failure. That's a retry: another attempt at the same operation. It can hide a brief interruption, but it also adds traffic and can make the caller wait longer.

What goes into a retry policy?

Start with two questions: Could another attempt succeed, and would it be safe? A dropped connection or a 503 may be temporary. Resending the same invalid input after a 400 Bad Request usually changes nothing. For 429 Too Many Requests or 503, honor Retry-After when the server provides it. If the caller can't wait that long, stop instead of retrying early.

Decide how long the caller can wait, not just how often it can retry. A per-attempt timeout limits one call; an overall deadline covers all calls and the waits between them. Three attempts means one initial call and up to two retries. Don't start another attempt if the caller has cancelled or the wait would use up the remaining time.

Exponential backoff is a way to space out retries, not a synonym for them. The calculated delay might double from 100 ms to 200 ms to 400 ms, up to a cap. But if thousands of clients all use those exact delays, they can hit the service in waves. Add jitter, for example by choosing a random wait between zero and the calculated delay, so the attempts are spread out. A server-provided Retry-After still sets the earliest retry time.

Example: a timeout doesn't mean nothing happened

Consider a POST that creates an order. The server might save the order and then lose the connection before the client sees the response. Sending the request again could create a second order. If the API supports idempotency keys, generate one before the first attempt and reuse it for every retry of that order. The server must use the key to recognize the duplicate and avoid creating another order. Merely adding a header does nothing if the API doesn't support it.

In practice and in interviews

Retries can live in an HTTP or gRPC client, a proxy, or a background job runner. Watch for overlapping policies: if a client makes three total attempts and a proxy makes up to three upstream attempts for each one, the backend can see nine calls for one user operation. This matters most when the backend is already overloaded.

In a system design interview, explain which layer owns retries, how it decides whether an error is retryable, and what happens when the deadline runs out. Distinguish retries from a circuit breaker: retries make another attempt after a likely temporary failure, while a circuit breaker can temporarily stop calls to a dependency that's repeatedly failing.