HTTP

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.

Descrição

The user has sent too many requests in a given time (rate limiting). The response should include a Retry-After header.

Quando você o vê

When hitting API rate limits or making too many requests too quickly.

Como corrigir

Check the Retry-After header. Implement exponential backoff. Consider caching responses.

Descrição

The server is temporarily unable to handle the request due to maintenance or overload. Should include a Retry-After header.

Quando você o vê

During maintenance windows, server overload, or when the application pool is exhausted.

Como corrigir

Wait and retry. Check the Retry-After header. Scale up servers if it's a capacity issue.

Diferenças principais

1.

429 is client-specific — this particular client sent too many requests within a time window.

2.

503 is service-wide — the server is unavailable for everyone due to maintenance, overload, or failure.

3.

Both should include a Retry-After header to tell the client when to try again.

4.

429 can often be resolved by the client by slowing down its request rate.

5.

503 is outside the client's control — the server needs to recover before any requests will succeed.

Quando usar qual

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.

Saiba mais