HTTP 429 Too Many Requests vs 503 Service Unavailable
Both 429 and 503 tell clients to back off and retry later, but they indicate different root causes. A 429 means the specific client has exceeded a rate limit, while a 503 means the service itself is unavailable for all clients, regardless of individual usage.
Описание
The user has sent too many requests in a given time (rate limiting). The response should include a Retry-After header.
Когда вы это видите
When hitting API rate limits or making too many requests too quickly.
Как исправить
Check the Retry-After header. Implement exponential backoff. Consider caching responses.
Описание
The server is temporarily unable to handle the request due to maintenance or overload. Should include a Retry-After header.
Когда вы это видите
During maintenance windows, server overload, or when the application pool is exhausted.
Как исправить
Wait and retry. Check the Retry-After header. Scale up servers if it's a capacity issue.
Ключевые различия
429 is client-specific — this particular client sent too many requests within a time window.
503 is service-wide — the server is unavailable for everyone due to maintenance, overload, or failure.
Both should include a Retry-After header to tell the client when to try again.
429 can often be resolved by the client by slowing down its request rate.
503 is outside the client's control — the server needs to recover before any requests will succeed.
Когда что использовать
Return 429 when a client exceeds its rate limit or quota — this signals them to implement backoff without affecting other clients. Return 503 when the entire service is down for maintenance, overloaded beyond capacity, or a critical dependency has failed. Include Retry-After with both codes.