You are reading this article because you are on shared hosting plan and have noticed that on the odd occasion your web site vanishes for a minute or so.
If you are on shared hosting, then you are literally sharing the server with other web sites meaning all resources such as CPU,RAM and disk space are shared between the all the users.
In the case one shared user has a web site which does any of the following, this causes "server load".
- Sending out mass emails
- Running lengthy cron scripts
- Rebuilding large indexes on Joomla, Magento which last longer than usual
- Getting a huge surge in traffic
- Using too much mysql process
- Web site is under ddos attack causing alot of trafic
- Running automated backups
However most times, developers or web site owners do not even realise they are causing excessive load until we spot it.
So how do we handle excessive server load?
If a user is causing excessive server load, then if it goes unchecked the whole server will crash causing expensive damage to server hardware and lots of downtime, ie a total melt down. So we have a automated system in place to handle such excessive loads. You should note, it does not matter how big a server is and what spec it is, if someone has a runaway script, the server load will keep going up until the server melts down, unless checks are in place.
In order to avoid server melt downs, please see an example of how we handle excessive server load.
NOTE: We consider "normal" server load to be anything between 1 and 2 which is optimal and 99.99% of the time is the server load reached on our server. If server load hits 8, we would start to be concerend but at this point no action needed apart from monitoring. If server load reaches 20 or more for an extended period of time, say 30 minutes, then we would consider this to be excessive usage and some form of action would be need to be taken.
Here is a example scenario of a user causing server loads and how we would handle it.
- User A is running a cron script which causes the server load to hit 6.
(6 is an acceptable level, server will still run fast and 99% of the time the excessive load is only temporary and will go back down to normal level of between 1 and 2 usually within 30 - 60 seconds). - Our automated service alerts our team along with a list of the services running at that time in case our team needs to investigate.
- User A's runaway script continues to run and causes server load to hit the threshold of 20.
- Our automated system immediately shuts down the web service and emails our team again with a first warning.
(Stopping the web service makes the server load go down but the caveat is that all web sites hosted on the server will appear down too) - Every 60 seconds the automated system checks the server to see if the load has gone down to below 10.
- If the load is below 10, the automated system restarts the web service and all web sites come back online.
- In case the server load goes back up again to 20, the web service is stopped again and our team is alerted so they can take action.