Web Fundamentals

Rate Limiting & API Resilience: Retries, Backoff, Jitter, Idempotency

Web Fundamentals Map

Rendering & Browser Architecture

Critical Rendering PathScript Loading Patterns (async/defer)Event Loop Deep DiveJavaScript Module Systems (CJS, ESM, UMD)Dynamic Module Loading (import())Import on InteractionImport on VisibilityBrowser Rendering Pipeline & Layout ThrashingRendering Strategies (CSR, SSR, SSG, ISR)Streaming SSR & Progressive HTMLIslands ArchitectureReact Server ComponentsFramework Reactivity (React, Vue, Svelte, Solid)HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)DNS Resolution & TTL Caching

Performance

Core Web Vitals: LCP, INP, CLSPerformance Optimization Trade-offsCritical Resource PrioritizationCode Splitting & Dynamic ImportsTree Shaking & Dead Code EliminationLazy LoadingResource Hints: Preload, Prefetch & PreconnectText Compression: Gzip & BrotliImage & Video OptimizationAdaptive LoadingList VirtualizationWeb Workers vs Main ThreadMemory Leaks: Detection & PreventionManaging Third-Party ScriptsHow CDNs WorkHTTP Caching Deep DiveService Workers & Offline StrategyPWA Fundamentals

Security

Cross-Site Scripting (XSS)Cross-Site Request Forgery (CSRF)CORS ExplainedCORS Preflight, Credentials & MisconfigurationsContent Security Policy (CSP)Why is HTTPS Secure? (TLS/SSL)Authorization Best PracticesCookie Security & Session Hardening

State & Data Architecture

State Management Guide (Context vs Zustand vs Redux)React Query & Server State CachingData Fetching PatternsCaching StrategiesPagination: Offset vs Cursor-BasedReal-time Communication (WebSocket, SSE, Polling)
mediumWeb Fundamentals

Rate Limiting & API Resilience: Retries, Backoff, Jitter, Idempotency

Learn the interview-ready mental model, practical trade-offs, and production patterns for this web fundamentals topic.

Topic content

TL;DRRetry only transient failures. Use exponential backoff + jitter. Respect Retry-After. Make mutations idempotent. Prevent retry storms.
High Signal
Google
Meta
Netflix
Agoda
30-Second Answerstart every interview with this

Modern distributed systems are unreliable. A good frontend client must intelligently retry transient failures while respecting server backpressure and preventing duplicate operations. Key techniques include exponential backoff with jitter, honoring Retry-After headers, and using idempotency keys for safe retries.

You don’t call back immediately after a busy signal (that creates a storm). You wait longer each time (backoff), add some randomness (jitter), and make sure repeating your request doesn’t charge you twice (idempotency). The server knows best when it’s ready again (Retry-After).

Request fails (transient)
Check if retryable
Apply backoff + jitter
Retry (up to limit)
Respect Retry-After when provided

1Transient vs Permanent Failures

Only retry transient errors (network timeout, 429, 503, 5xx). Never retry permanent client errors (400, 401, 403) as they won’t succeed without user intervention.

isRetryable.tsts
function isRetryable(error: any): boolean {
  if (!error.response) return true; // network error
  const status = error.response.status;
  return status === 429 || status >= 500;
}

2Exponential Backoff + Jitter

Increase delay between retries exponentially. Add randomness (jitter) to prevent synchronized retry storms that can overwhelm the server.

3Idempotency & Safe Retries

Use idempotency keys for mutations (POST/PUT/DELETE) so repeated requests produce the same result. Critical for payments, order creation, etc.

4Respecting Rate Limits (429)

Honor Retry-After header when present. Implement client-side rate limiting and circuit breakers for better resilience.

Key Takeaways
  • ✓Only retry transient failures (network, 5xx, 429)
  • ✓Exponential backoff + jitter prevents retry storms
  • ✓Always respect Retry-After header when provided
  • ✓Make mutations idempotent using keys
  • ✓Cap retry attempts to avoid infinite loops
  • ✓Implement client-side rate limiting and circuit breakers
  • ✓Resilience protects both UX and backend stability
PreviousNext

Topic Guide

On this page