# 117 - Service Unavailable

> Episode of [How To Code Well](https://podistic.com/podcast/how-to-code-well.md) · Published June 18, 2021 · Duration 30:23 · Episode 117, season 4

- **Listen on Podistic:** https://podistic.com/episode/117-service-unavailable
- **Audio:** https://anchor.fm/s/2d0cded8/podcast/play/35688850/https%3A%2F%2Fd3ctxlq1ktw2nl.cloudfront.net%2Fstaging%2F2021-5-17%2F8fec2d5c-0114-87e4-d780-c2725de6adcd.mp3 (audio/mpeg)

## About this episode

In todays podcast we are going to talk about the 503 HTTP Status Code. 

**Error 503 = Service Unavailable** 

From the W3C: The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.   

**Causes**

*    DDOS attacks will result in high resource usage which will eventually overload the server.  As a result the server will respond with a 503 error code. 
*   A server might be temporarily  un available if it is under going maintenance.  Its a server issue and not a client issue.  So this wouldn’t be an issue with the HTML or CSS or client sided JavaScript  Trouble shooting 
*   Check any monitoring dashboards or graphs for resource hungry trends. - Check the logs to find any server related errors.   
*   Check the logs for access requests to see if its a spike in traffic.  
*   Check if the server is going through an unexpected maintenance  
*   Check for firewall config. Perhaps a firewall on the network is preventing traffic from flowing.  
*   Check for long running scripts that could be causing memory leaks.   
*   Check for disk usage.  Perhaps you are running out of swap space if that’s configured.  

**Solutions** 

*   Stop any jobs that are running 
*   Divert traffic using a load balancer to another server -
*   Scale your application horizontally by bring on other servers/containers to handle the traffic 
*   Have an auto scaler which keeps adding or removing servers/containers when needed - Reboot the server/container

**Resources:**

[https://thevaluable.dev/dry-principle-cost-benefit-example/](https://thevaluable.dev/dry-principle-cost-benefit-example/)

[https://metova.com/dry-programming-practices/](https://metova.com/dry-programming-practices/)

Kick start your tech career with Amarachi Amaechi's new book [**Getting Started in Tech: A guide to building a tech career**](https://gumroad.com/a/314578035/HxeaI)

My web development courses

➡️ [Learn How to build a JavaScript Tip Calculator ](https://www.youtube.com/watch?v=l3cUp-HEmuI\&list=PLZdsdjcJ44WVa4lhVwkCtQPSG8aqgjzjK)

➡️ [Learn JavaScript arrays](https://www.youtube.com/watch?v=K3WzmRXtExg\&list=PLZdsdjcJ44WWaBGywrjhXjlJnilh6Z0NX)

➡️ [Learn PHP arrays](https://www.youtube.com/watch?v=C9gILLIyV-M\&list=PLZdsdjcJ44WUWbArkekAHznqfJ60vW8V_)

➡️ [Learn Python](https://www.youtube.com/watch?v=mYt8kFobRBc\&list=PLZdsdjcJ44WXkZs76CYt5n9pW6j3WmWeJ)

✉️ [Get my weekly newsletter](https://email.howtocodewell.net/signup)

⏰ My current live coding schedule (Times are BST)

Thursdays 20:00 = [Live Podcast YouTube](https://www.youtube.com/howtocodewell/live)

Sundays 14:30 - [Live coding on Twitch](http://twitch.tv/howtocodewell)
