Truncated Exponential Backoff
Resilience Patterns

Meaning

Truncated exponential backoff is a retry algorithm that increases the wait time between successive attempts exponentially while capping the maximum delay. It addresses the pain of overwhelming a service with rapid retries after transient failures. It is used when a client repeatedly encounters errors such as timeouts or HTTP 5xx responses and needs to back off gracefully.

Primary Function

Retry strategy

Communicative Purpose

Prevents overwhelming a service by spacing out repeated requests after failures.

Pattern

attempt request → compute delay = min(max_delay, base_delay * 2^retry_count) → sleep → retry

Core Structure

delay = min(max_delay, base_delay * 2 ** attempt)

Função primária

Retry strategy

Propósito comunicativo

Prevents overwhelming a service by spacing out repeated requests after failures.

Situações de gatilho

Web API client: transient HTTP 502 errors; Distributed system: node communication timeouts

Contextos

Microservices, cloud SDKs, network libraries, client-side JavaScript, Python requests library

Padrão

attempt request → compute delay = min(max_delay, base_delay * 2^retry_count) → sleep → retry

Estrutura central

delay = min(max_delay, base_delay * 2 ** attempt)

Colocados típicos

  • max_delay
  • base_delay
  • retry_count
  • sleep
  • jitter

Substituições comuns

  • add random jitter to delay → reduces thundering herd
  • use linear backoff instead of exponential → simpler but less effective

Erros comuns

Using a fixed max_delay that is too low → retries stop prematurely; Forgetting to reset the attempt counter after a successful call → delay grows unnecessarily; Applying backoff to non-transient errors → wastes time on permanent failures

Similar / contraste

Linear backoff – increases delay by a constant amount; Fixed delay retry – uses the same wait time each attempt; Circuit breaker – stops retries entirely after a threshold

Interferências

Coming from JavaScript: using setTimeout with a constant interval → misses exponential growth and can overload the server

Família do chunk

  • Retry logic
  • Circuit breaker
  • Rate limiting
  • Jitter

Nuance

Do not use when the operation is idempotent and quick, as backoff adds latency; The capped delay limits worst-case wait time, but may still cause noticeable pause if max_delay is high; Adding jitter is important to avoid synchronized retries across many clients

Efeito pragmático

Reduces load spikes on services, improves overall system stability, and lowers the chance of cascading failures.

Dica de memória

Exponential backoff is like a cautious driver who doubles the distance between attempts after each red light, but never exceeds a safe maximum distance.

Nota

Choosing an appropriate max_delay balances responsiveness with protection against overload.

Upgrade path

Decorrelated jitter backoff

Frequência: HighFormulaicidade: FixedTipo de construção: algorithmic patternPrioridade de aquisição: Recognition firstPrioridade de output: BothTag de espaçamento: Medium-term

Log in to save chunks.