Real CPU load-based

The real CPU load-based configuration is one of the rules used for managing CPUs with the cpuplugd daemon.

The full configuration file is listed in cpuplugd configuration files.

This configuration uses the CPU load values (from /proc/stat). The values of user, system, and nice are counted as active CPU use. idle, and iowait are considered as unused CPU capacity. These values start increasing from system start.

The averages over the last three intervals are taken and divided by the corresponding time interval. The resulting values are stored in the variables CP_ActiveAVG and CP_idleAVG. The corresponding rules are as follows:

HOTPLUG="((1 - CP_ActiveAVG) * onumcpus) < 0.08"
HOTUNPLUG="(CP_idleAVG * onumcpus) > 1.15"

The values of CP_ActiveAVG and CP_idleAVG are between 0 and 1. Therefore, 1 - CP_ActiveAVG is the unused CPU capacity. When multiplied by the number of active CPUs, it is specified in CPUs. When the total unused CPU capacity falls below 8% of a single CPU, a new CPU is added. If the total amount of idle capacity is larger than 115% (this is 15% more than one CPU free), a CPU is withdrawn.

The steal time is not included in these calculations. Steal time limits the amount of available CPU capacity, thus ensuring that no additional CPUs are plugged in, as this would worsen the scenario. You could consider including the steal times in the unplug rule, whereupon significant steal times would cause CPUs to be removed, leading to reduction in pressure on the physical CPUs.

Figure 1 shows the effect of the CPU management rules over time when managed based on real CPU load:
Figure 1. Number of active CPUs over time when managed by cpuplugd based on real CPU load
Graph showing the number of active CPUs over time when managed by cpuplugd based on real CPU load.
Table 1. Throughput and average CPU load when managed by cpuplugd based on real CPU load values

Throughput and average CPU load when managed by cpuplugd based on real CPU load values.

Configuration TPS* Relative CPU load*
real cpu load based 96% 96%
*100% is the manual-sized run

Observation

The automated sizing values are the same as the manual sizing settings. The system reacts very fast to load variations. The throughput closely approximates the throughput of the manual sizing.

Conclusion

This is a very good solution when the objective is to adapt the number of CPUs directly to the load requirements. The automated values are very close to the manual settings. This rule is used for managing the number of active CPUs in all subsequent runs.