Is there something like this, but for MySQL?
<?php
if (function_exists('sys_getloadavg')) {
$load = sys_getloadavg();
if ($load[0] > 60) {
header('HTTP/1.1 503 Too busy, try again later');
die('Server too busy. Please try again later.');
}
}
There's no standard function for that for sure.
So your options are:
1) if on linux: read from `/proc/loadavg', e.g.:
2) write a User Defined Function in C to retrieve the value
I'm pretty sure I've seen a UDF for this in the past, but my Google skills fail me in finding it again right now ...