Just would like to get some clarifications on the relationship between system.cpu.count metric and system.cpu.usage metric from SpringBoot 2.3.1 actuator metric endpoints.
For example, in my case:
The value of /actuator/metrics/system.cpu.count is: 2
The value of /actuator/metrics/system.cpu.usage is: 0.024765603908878
Does this mean that my cpu utilization percentage is: 0.024765603908878 / 2 * 100 = 1.24% ?
The metrics are provided in Spring Boot by Micrometer, specifically by Micrometer's ProcessorMetrics
. Looking at its source, we can learn that system.cpu.count
is backed by java.lang.Runtime.availableProcessors()
and system.cpu.usage
is backed by com.sun.management.OperatingSystemMXBean.getSystemCpuLoad()
. Looking at those methods tells us that:
system.cpu.count
is the number of CPUs that are available to the JVM.system.cpu.usage
is a value between 0.0 and 1.0 inclusive where a value of 0.0 means that all CPUs were idle during the recent period of time observed, while a value of 1.0 means that all CPUs were actively running 100% of the time during the recent period being observed.Your value of 0.025 indicates that CPU utilization was 2.5% of its total capacity. As you have two CPUs, this could be one CPU running at 5% and the other at 0%, both CPUs running at 2.5%, or any other combination in between.