The backend had a 2-minute blip and stayed down for 40. How mobile retries turn small outages into big ones.
The incident: the API slowed down for a couple of minutes, which happens. But it didn't recover when the cause was fixed. Traffic stayed at several times the normal level until someone rate limited the mobile clients at the edge. The extra traffic came from installed apps retrying. Retries are meant to hide short failures from users. Written carelessly, they multiply load exactly when the server…
An API slowdown for a brief period turned into a longer outage affecting many users. Traffic surged several times higher than normal because mobile clients repeatedly retried failed requests. This amplification happened at multiple layers, with networking libraries, repository wrappers, and screens all attempting retries. Everyone retried simultaneously, causing repeated spikes that overwhelmed the server.
The issue was compounded by clients launching after the outage and apps reopening, both triggering fresh retries. To avoid this, retries should only be used when another attempt is plausible and safe to repeat, such as connection failures or 502, 503, 504, and 429 status codes. Not restarting a request that timed out or was 400, 401, 403, 404, 409, or 422 is advisable.
Clients should implement exponential backoff with jitter, a small attempt cap, and respect Retry-After headers. A circuit breaker can stop sending requests to a failing host, allowing a single test request to check if the server has recovered. Background sync should use platform schedulers with built-in backoff instead of implementing retries manually.
Testing for these issues involves simulating outages and analyzing the number of requests sent during and after them, ensuring the app sends few requests and does not spike when the outage ends.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to