Server Load High / MySQL death
By Paul
4.5/5 based on 2 votes. The median rating is 4.
By Paul
There are basically two types of sites with server load problems: extremely popular sites, and sites which are being overrun by periodic bursts of traffic or uncontrolled spiders. If you have a famous website, congratulations... give the cache system due consideration as a possible method to handle the fruits of your fame. If there are usergroups (especially unregistered guests) for which you don't need constant real-time page updates, it'll drop your load drastically. If you only want it used in emergency situations you can specify a server load number above which the cache will be automatically activated for guests, while they still get fully dynamic pages when the server is feeling up to it.
When your server load becomes high, pages become slow and a chain reaction is started where the server load keeps going higher as people keep trying to access the page while it's working, eventually resulting in Apache giving up and dying altogether until restarted. It can be useful to have an emergency method to halt this chain reaction before it reaches a critical stage, and that's one of the things this article is about.
Before continuing to read this article, please be sure that this is actually your problem. Enabling debug mode to show totals and execution time will allow you to view the server load on a Unix system (though not on a Windows server). Generally, server loads over 5 are a danger zone where there server is likely to suffer significantly and MySQL could cease responding. Anything over 3 is likely to cause noticeable slowing. If you can't check your server load, noticing page load times increase dramatically at times you have lots of guests online would be a clue. A "cannot connect to mysql through socket" sort of error message, when you're sure your config.php is correct and your host isn't doing maintenance, is also an indication.
Sometimes search engine spiders can have the same force as a DDOS attack, causing MySQL to slow and finally stop responding. Check your robots.txt to be sure you have a good crawl-delay value (at least 30 seconds). Sometimes there are bots that won't obey, or other sorts of traffic floods that can kill MySQL on a large site. You can limit the possible threat of such activity in your SEO settings by selecting to block spiders from non-essential pages (pages you really don't need indexed anyhow).
As a precaution in severe circumstances you may wish to lock out spiders or guests entirely when the server load is above a certain level. If you have a Unix(/Linux/BSD) server and PHP is not in safe mode you may do this by going to Admin -> Settings -> System and setting the level for rejecting spiders/guests where it asks. 5 could be a good level. The load should go down quickly as the cause of it is locked out.
When your server load becomes high, pages become slow and a chain reaction is started where the server load keeps going higher as people keep trying to access the page while it's working, eventually resulting in Apache giving up and dying altogether until restarted. It can be useful to have an emergency method to halt this chain reaction before it reaches a critical stage, and that's one of the things this article is about.
Before continuing to read this article, please be sure that this is actually your problem. Enabling debug mode to show totals and execution time will allow you to view the server load on a Unix system (though not on a Windows server). Generally, server loads over 5 are a danger zone where there server is likely to suffer significantly and MySQL could cease responding. Anything over 3 is likely to cause noticeable slowing. If you can't check your server load, noticing page load times increase dramatically at times you have lots of guests online would be a clue. A "cannot connect to mysql through socket" sort of error message, when you're sure your config.php is correct and your host isn't doing maintenance, is also an indication.
Sometimes search engine spiders can have the same force as a DDOS attack, causing MySQL to slow and finally stop responding. Check your robots.txt to be sure you have a good crawl-delay value (at least 30 seconds). Sometimes there are bots that won't obey, or other sorts of traffic floods that can kill MySQL on a large site. You can limit the possible threat of such activity in your SEO settings by selecting to block spiders from non-essential pages (pages you really don't need indexed anyhow).
As a precaution in severe circumstances you may wish to lock out spiders or guests entirely when the server load is above a certain level. If you have a Unix(/Linux/BSD) server and PHP is not in safe mode you may do this by going to Admin -> Settings -> System and setting the level for rejecting spiders/guests where it asks. 5 could be a good level. The load should go down quickly as the cause of it is locked out.
Rating:
4.5/5 based on 2 votes. The median rating is 4.
Submitted: 06/21/05 (Edited 06/30/08)
Description: Emergency measures to deal with extreme loads.
Views:
1619 views. Averaging 1 per day.
In the most recent 30 day period, there've been 12 views.

Print
E-Mail