Created
August 7, 2010 09:26
-
-
Save shameerc/512626 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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.'); | |
} | |
/* | |
This is a function which returns three samples of the “load” on a system. Load is the number of processes in the system run queue. The 3 items in the array are the average load for the past 1, 5 and 15 minutes. The PHP Manual shows a great usage of this: | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment