In Linux, the load average is said to be on 1min/5min/15min. The formula used by the kernel is actually an Exponential moving average.
If we define cpuload(1)
as the first computation of the cpu load 1min, and active()
as the function returning the number of process in state "running" or "runnable" on the system, then the formula used by the kernel to compute the nth cpu load 1min is:
cpuload(0)
is 0; it is the value stored in memory before the first execution of cpuload()
.
My question is, how was the weighting 2-5.log2(e)/60 chosen? In my opinion, 2-5/60 would have been better because 1min would have been the half-life of the number of process (because (2-5/60)12 = 1/2).
Maybe it's helpful if i post the explicit formula of cpuload(n)
in addition to the recursive definition above (right-click to see it in full size):
Load Average in Linux takes into account the waiting threads and tasks along with processes being executed. Also, it is an average value instead of being an instantaneous value. However, an approximate idea of resource usage can be determined by the ratio of Load Average over the number of cores of your processor.
The vmstat command's "r" column under "procs" shows the current number of processes waiting to get on the run queue at a given instant in time. The uptime command shows the average number of processes on the run queue and waiting to get on the run queue in the last one, five and fifteen minutes.
The load average is relative to the number of cores available in the server and not how they are spread out over CPUs. This means the maximum utilization range is 0-1 for a single core, 0-2 for a dual core, 0-4 for a quad core, 0-8 for an octa-core, and so on.
On Linux, load averages are (or try to be) "system load averages", for the system as a whole, measuring the number of threads that are working and waiting to work (CPU, disk, uninterruptible locks). Put differently, it measures the number of threads that aren't completely idle.
Consider a particular load sample active(K), and how much that sample contributes to cpuload(K+d), for increasing values of d. There are a few key observations:
Together, these points mean that there is some dmin such that, for d>dmin, active(K)W(d)=0 and so active(K) has no influence on cpuload(K+d). In short, cpuload(n) is only influenced by dmin previous samples.
Another way to look at this is that cpuload(n) forgets data after a time defined by
This final interpretation gives the meaning of the 1-minute, 5-minute, and 15-minute load averages. The decay and the sampling interval are chosen so that these load averages forget the past after 1, 5, and 15 minutes respectively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With