sys_getloadavg
Obtain the average load of the system
sys_getloadavg() function returns the average value of the system load.
This function returns an array of three numbers representing the average system load for the past 1 minute, 5 minutes and 15 minutes respectively.
Note: This function is not implemented on the Windows platform.
Check the system load average. If it exceeds 0.8, stop the script and display a message:
<?php
$loadtime = sys_getloadavg ( ) ;
if ( $loadtime [ 0 ] > 0.80 ) {
die ( 'Sorry, server is busy.' ) ;
}
?>
sys_getloadavg ( )