Skip to content

Instantly share code, notes, and snippets.

@shameerc
Created August 7, 2010 09:26
Show Gist options
  • Save shameerc/512626 to your computer and use it in GitHub Desktop.
Save shameerc/512626 to your computer and use it in GitHub Desktop.
$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