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
November 29, 20260
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
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- 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 ProblemsSample Answer
Requirements
reconnect(connect)returns the connection or raises aftermax_attempts.- Delay for attempt n is random in [0, min(cap, base x 2^n)].
- Only
RetryableErroris retried; aretry_afterattribut...
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...