Results 1 to 13 of 13
-
11-20-2013, 01:58 PM #1Newbie
- Join Date
- Nov 2013
- Posts
- 7
Show "server is busy" page at high CPU load average
Hello.
I want to show a "server is busy, try again later" page when my web server CPU load average is high. How can I do that? I'm on CentOS 6.4 with Apache/WHM/Cpanel.
-
11-20-2013, 02:11 PM #2Attack The Day
- Join Date
- May 2010
- Location
- NYC
- Posts
- 835
What software/script are you using on your websites? Some software has this built in. For example MyBB has an option called "maximum server load" which does what you're looking for.
-
11-20-2013, 02:34 PM #3Newbie
- Join Date
- Nov 2013
- Posts
- 7
I have WordPress. I am looking for a linux/apache/whm/cpanel method to do this.
-
11-20-2013, 03:13 PM #4Web Hosting Master
- Join Date
- Nov 2011
- Posts
- 582
You should be able to optimize both apache and mysql to get better server load average. What type of hardware are you running on? Have you looked through the cPanel doc's? That is usually your best ticket on where to find out the "tips and tricks"
-
11-20-2013, 03:20 PM #5Newbie
- Join Date
- Nov 2013
- Posts
- 7
The webserver is optimized. My webserver has spikes that break it. I just want to show a "server busy" page that can keep CPU usage under normal parameters.
-
11-20-2013, 03:21 PM #6Web Hosting Master
- Join Date
- Aug 2003
- Location
- East Coast
- Posts
- 2,082
What process is using all of your cpu?
-
11-20-2013, 03:49 PM #7Newbie
- Join Date
- Nov 2013
- Posts
- 7
PHP and mySQL
-
11-20-2013, 04:43 PM #8Junior Guru Wannabe
- Join Date
- Nov 2013
- Posts
- 83
Are you wanting to just customize a 500 series error message that Apache naturally shows or do you want a mechanism to automatically trigger the splashscreen?
-
11-20-2013, 04:50 PM #9Newbie
- Join Date
- Nov 2013
- Posts
- 7
11
Well, when these spikes happen the website is unresponsive and the server breaks, I get high CPU usage, server remains without memory and it requires manual intervention. I just want to show a page when the cpu load is higher than x (or a similar mechanism).
-
11-20-2013, 04:55 PM #10Junior Guru Wannabe
- Join Date
- Nov 2013
- Posts
- 83
PHP has a function that may work. They recommend the below code (from their site). You would need to tweak the output to display the HTML you would like to display:
<?php
$load = sys_getloadavg();
if ($load[0] > 80) {
header('HTTP/1.1 503 Too busy, try again later');
die('Server too busy. Please try again later.');
}
?>
-
11-20-2013, 06:05 PM #11Newbie
- Join Date
- Nov 2013
- Posts
- 7
bestssdhost thank you very much!
Is there a more "global" solution? It's a pain in the *** to implement this code in every client's website.
-
11-21-2013, 03:57 AM #12Newbie
- Join Date
- Nov 2013
- Posts
- 7
Is there an option for apache to limit the maximum of http requests/second that will accept?
-
11-21-2013, 05:02 AM #13Temporarily Suspended
- Join Date
- May 2013
- Location
- India
- Posts
- 747
Rather than using such custom solution, I suggest to use solutions like CloudLinux or 1H HIVE manage server resources. Ofcourse using them needs to add a few more $ ; but that will be a worth for shared hosting.
Code:Is there an option for apache to limit the maximum of http requests/second that will accept?
Similar Threads
-
Server Load - What is "Good", What is "Bad", and What is "UGLY"?
By NashChristian in forum Web HostingReplies: 39Last Post: 02-22-2008, 03:22 AM -
High server load and "resource outage" error
By McClickson in forum Hosting Security and TechnologyReplies: 2Last Post: 01-09-2006, 10:48 PM -
What is your average "Server Load"?
By 0218 in forum Dedicated ServerReplies: 20Last Post: 04-30-2004, 06:36 AM -
Load Average Tool "sar" - where did it go in RHEL?
By HD-Sam in forum Hosting Security and TechnologyReplies: 1Last Post: 04-04-2004, 04:06 PM -
"load average we are working on" << picture included
By Mdot in forum Dedicated ServerReplies: 11Last Post: 12-11-2002, 04:21 AM