CPU Utilization

How is it calculated?

CPU utilization is measured by the time a CPU instance is busy performing work during an interval, expressed as a percentage. It can be measured as the time a CPU is not running the kernel idle thread but is instead running user-level application threads or other kernel threads, or processing interrupts.
β€” Brendan Gregg

Problematic is that the waiting time for other resources is part of the utilization.
90 % CPU utilization:
CPU Utilization-20240601165430923.webp

Stalled means the processor was not making forward progress with instructions, and usually happens because it is waiting on memory I/O. The ratio I drew above (between busy and stalled) is what I typically see in production. Chances are, you're mostly stalled, but don't know it.
β€” Brendan Gregg

Is CPU Utilization a Bad Metric?

Thoughts by Adrian Cockcroft

The most fundamental assumption here is that the average service time is constant, and does not depend upon the load level. This is one of the assumptions that has been broken by virtualization, Hyper-threading and variable speed power-saving CPUs.
β€” Adrian Cockcroft (http://www.hpts.ws/papers/2007/Cockcroft_CMG06-utilization.pdf)

Challenges:

Thoughts by Brendan Gregg

CPU Utilization is Wrong
CPU utilization is wrong - YouTube

CPU Utilization vs. CPU Time

Energy Consumption of Software – Using CPU Time or CPU Utilization as a Proxy

Tools

Windows

Linux

πŸ”— References

CPU Utilization - A useful metric? by Arne Tarara

CPU Utilization is Wrong by Brendan Gregg