Gen. partnerAlgotech

PHP function sys_getloadavg()

Example:

|
September 11, 2019

Version availability: PHP 5.1.3

Gets the average system load. Same values as you know from the htop tool in Linux.

Example:

$load = sys_getloadavg();
if ($load[0] > 0.80) { // is the load greater than 80%?
header('HTTP/1.1 503 Too busy, try again later');
die('Server is overloaded, try again later.');
}

Parameters

The function has no input parameters.

Return values

array

Array with three samples (last 1 minute, 5 minutes and 15 minutes).

Other resources

Official sys-getloadavg documentation

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.