How were the weightings in the linux load computation chosen?
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:
- active(K) is multipled by some weight W(d) to determine its contribution to cpuload(K+d).
- W(d) is always less than one.
- W(d) decreases exponentially as d increases.
- computer arithmetic has finite precision.
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
- the decay exponent, which defines dmin, and
- the sampling frequency.
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.