The server is reachable, but it's saying it can't take the request right now. That's usually one of three things: it's overloaded (out of memory, CPU or database connections), it's in maintenance or partway through a deploy, or the platform has no running copy of your app to send requests to because the app crashed or was switched off.
What's the problem
Visitors see "503 Service Unavailable". It might last a minute during a deploy, come and go at busy times, or stay until someone does something.
Why it happens
- Maintenance or a deploy. Some setups deliberately return 503 while the app restarts. That should be brief.
- Overload. When memory, CPU or the pool of database connections runs out, servers turn requests away with a 503 rather than fall over completely. If 503s line up with busy periods, this is it.
- Nothing is running. On platforms such as Heroku, a crashed app or one that didn't start in time produces a 503. So does an app with its web process scaled down to zero.
How to fix it
- Watch how long it lasts. A minute around a deploy is normal. Longer isn't.
- Check that at least one copy of your app is running on your host's dashboard. If none is, the logs say why it stopped or failed to start.
- Look at memory, CPU and database connection graphs for the times the 503s happened. A line hitting its ceiling is your answer.
- If it's load, add capacity (bigger or more instances, a larger database plan) as a stopgap, then find what's using it up.
- For planned maintenance, return a 503 with a
Retry-Afterheader and a friendly page, so visitors and search engines know it's temporary.
When to call Preventionlabs
If the app had simply stopped, restarting it and fixing the cause in the logs may be all it needs. Call us when 503s keep coming back under ordinary traffic, or the app can't be given more capacity without being rebuilt. A resurrection delivers an app that's running and on infrastructure that adds capacity through configuration, not code changes.
Submit your project for a free assessmentFree assessment. $10,000 AUD flat to get it live, only if we take it on and you go ahead.
Sources
- MDN Web Docs: 503 Service Unavailableweb reference
Common causes are that a server is down for maintenance or overloaded.
- MDN Web Docs: 503 Service Unavailableweb reference
In overload cases, some server-side applications will reject requests with a 503 status when resource thresholds like memory, CPU, or connection pool limits are met.
- Heroku: Heroku Error Codes: H10 App crashedhosting platform docs
A crashed web dyno or a boot timeout on the web dyno will present this error.
- Heroku: Heroku Error Codes: H14 No web dynos running (example log line, status=503)hosting platform docs
at=error code=H14 desc="No web processes running" method=GET path="/"
- MDN Web Docs: 503 Service Unavailableweb reference
This response should be used for temporary conditions and the Retry-After HTTP header should contain the estimated time for the recovery of the service, if possible.