Throttling stats are available in
/sys/fs/cgroup/cpu/cpu.statAs per documentation of k8s CPU requests, the number is translated
into a value that goes into/sys/fs/cgroup/cpu/cpu.sharesIf container A on a node has
cpu.sharesvalue twice that of container B, then it will get twice amount of time if both are trying to run simultaneously.Is this considered as throttling for container B based on
cpu.sharesvalue?If so, how can we measure this kind of throttling?
CodePudding user response:
First of all CPU shares don't make sense until after CPU pressure occurs. As long as there is enough CPU all tasks may run for as much time as they want.
Second, CPU requests do not cause throttling, only limits do. For more details please read more about Quality of Service for Pods.
You can measure CPU throttling due to CPU limits using Metrics-server or Prometheus like that: https://github.com/kubernetes-monitoring/kubernetes-mixin/blob/master/alerts/resource_alerts.libsonnet#L143
