Energy estimation TDP plugin
Introduction
This plugin estimate the energy consumption for pods based on the TDP value of the machine where pods are running. The TDP (Thermal Design Power) is the maximum amount of heat generated by a computer component. Refer to the wikipedia page of TDP for more details.
In the first version of the plugin, we consider only the TDP of the CPU.
This plugin requires the cgroupv2 input plugin (k8s) as it needs the input measurements of cgroups v2.
The estimation calculation is done using the following formula:
$$\Large Energy=\frac{cgroupv2cpu total usagenb_vcpuTDP}{10^6pooling_interval*nb_cpu}$$
cgroupv2_cpu_total_usage
: total usage of CPU in micro seconds for a podnb_vcpu
: number of virtual CPU of the hosting machine where pod is runningnb_cpu
: number of physical CPU of the hosting machine where pod is runningpolling_interval
: polling interval of cgroupv2 input plugin
Energy estimation tdp plugin
The binary created by the compilation will be found under the target repository.
Prepare your environment
To work this plugin needs k8s plugin configured, so the needed things are related to k8s plugin requirements:
- cgroup v2
- kubectl
- alumet-reader user
Configuration
[plugins.EnergyEstimationTdpPlugin]
poll_interval = "30s"
tdp = 100.0
nb_vcpu = 1.0
nb_cpu = 1.0
pool_interval
: must be identical to the poll_interval of input k8s plugin. Default value is 1s.nb_vcpu
: number of virtual cpu allocated to the virtual machine in case of kubernetes nodes are virtual machine. Using the kubectl get node command, you can retrieve the number of virtual cores. If the kubernetes nodes are physical machine, assign it to value 1. Default value is 1.
To get the CPU capacity of a kubernetes node, execute the following command:
kubectl describe node <node name> | grep cpu -B 2
Hostname: <node name>
Capacity:
cpu: 32
nb_cpu
: number of physical cpu of the hosted machine. Using thelscpu
orhwinfo
, you can retrieve the number of cpu. If the kubernetes nodes are physical machine, assign it to value 1. Default value is 1.
tdp: Thermal Design power; each CPU has a calculated thermal design value; the value can be find on internet (usually on CPU manufacturer); you need the exact CPU family (using command lscpu
or hwinfo
). For example, for Intel® Xeon® D Processor, family D-2183IT, the tpd can be found it's intel documentation page
tdp value is 100W.
Default value is 100.