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.