php8.5
Home/ Manual/ misc / functions/ sys_getloadavg

sys_getloadavg

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.3, PHP 7, PHP 8)

Gets system load average

Description

sys_getloadavg(): array|false

Returns three samples representing the average system load (the number of processes in the system run queue) over the last 1, 5 and 15 minutes, respectively. Returns false on failure.

Parameters Parameters

Return Values

Returns an array with three samples (last 1, 5 and 15 minutes).

Examples

A sys_getloadavg() example

php
<?php
$load = sys_getloadavg();
if ($load[0] > 0.80) {
    header('HTTP/1.1 503 Too busy, try again later');
    die('Server too busy. Please try again later.');
}
?>

Notes No-windows

Source: reference/misc/functions/sys-getloadavg.xml · from the official PHP manual (php/doc-en)