Right now I don't have time to optimize and to upgrade servers and once or twice a month the server reaches critical load (mysql basically) and it goes very very slow.
I want to show a static message saying the server is too busy when that happens.
How would I do that?
There's a function for that: http://www.php.net/manual/en/function.sys-getloadavg.php
example usage:
<?php
$maxLoad = 10;
$load = sys_getloadavg();
if ($load[0] > $maxLoad) {
header('HTTP/1.1 503 Too busy, try again later');
die('Server too busy. Please try again later.');
}else{
show_my_page();
}