Exponential Backoff With Full Jitter for Messenger Reconnects

Last updated: November 29, 2026

Quick Overview

Write the reconnect loop a Messenger web client uses when its realtime connection drops: retry with capped exponential backoff and full jitter, honor a server Retry-After hint, and never retry non-retryable errors.

Meta
Software Engineering Fundamentals
Frontend Engineer
Meta
November 29, 2026
Frontend Engineer
Phone Screen
Software Engineering Fundamentals
Easy

0

0

0 solved


Write the reconnect loop a Messenger web client uses when its realtime connection drops: retry with capped exponential backoff and full jitter, honor a server Retry-After hint, and never retry non-retryable errors.

When an edge cluster restarts, millions of Messenger and WhatsApp Web clients disconnect at the same moment, and how they reconnect decides whether the cluster comes back or gets knocked over again. This networking-basics question checks whether you understand synchronized retries, jitter, and the difference between transient and permanent failures.

What the Interviewer Expects
  • Grows delay exponentially and caps it
  • Adds full jitter so clients that failed together do not retry together
  • Separates retryable errors (timeouts, 503, resets) from non-retryable ones (auth failures)
  • Honors a server-provided Retry-After when it is longer
  • Makes sleep and randomness injectable so the loop is testable
  • Bounds total attempts and surfaces a final error to the UI
Key Topics to Cover
exponential backoff
jitter
thundering herd
retry policies
networking basics
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • Why is full jitter better than adding a small random offset to a fixed exponential delay?
  • How would you reset the backoff after a connection stays healthy for a while?
  • What should the UI show during retries, and when should it stop trying automatically?
  • How would the server side shed load during a reconnect storm?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • reconnect(connect) returns the connection or raises after max_attempts.
  • Delay for attempt n is random in [0, min(cap, base x 2^n)].
  • Only RetryableError is retried; a retry_after attribut...
High-Level Design

Plain exponential backoff spaces each client's retries out, but clients that disconnected at the same instant still retry at the same instants (0.5s, 1s, 2s), producing synchronized spikes. **Full jit...


Submit Your Answer
Markdown supported