Hi,

JVM.CPU.Load is just a wrapper (MetricUtils.instantiateCPUMetrics) on top of 
OperatingSystemMXBean.getProcessCpuLoad (see 
https://docs.oracle.com/javase/7/docs/jre/api/management/extension/com/sun/management/OperatingSystemMXBean.html#getProcessCpuLoad())

Usually it looks weird if you have multiple CPU cores. For example, if you have 
a job with a single slot 100% utilizing a single CPU core on a 8 core machine, 
the JVM.CPU.Load will be 1.0/8.0 = 0.125. It's also a point-in-time snapshot of 
current CPU usage, so if you're collecting your metrics every minute, and the 
job has spiky workload within this minute (like it's idle almost always and 
once in a minute it consumes 100% CPU for one second), so you have a chance to 
completely miss this from the metrics.

As for me personally, JVM.CPU.Time is more clear indicator of CPU usage, which 
is always increasing amount of milliseconds CPU spent executing your code. And 
it will also catch CPU usage spikes.

Roman Grebennikov | g...@dfdx.me


On Mon, Aug 3, 2020, at 23:34, Bajaj, Abhinav wrote:
> Hi,

>  

> I am trying to understand the CPU Load metrics reported by Flink 1.7.1 
> running with openjdk 1.8.0_212 on K8s.

>  

> After deploying the Flink Job on K8s, I tried to get CPU Load metrics 
> following this documentation 
> <https://ci.apache.org/projects/flink/flink-docs-release-1.7/monitoring/metrics.html#rest-api-integration>.

> curl 
> localhost:8081/taskmanagers/7737ac33b311ea0a696422680711597b/metrics?get=Status.JVM.CPU.Load,Status.JVM.CPU.Time

> [{"id":"Status.JVM.CPU.Load","value":"0.0023815194093831865"},{"id":"Status.JVM.CPU.Time","value":"23260000000"}]

>  

> The value of the CPU load looks odd to me.

>  

> What is the unit and scale of this value? 

> How does Flink determine this value?

>  

> Appreciate your time and help here.

> ~ Abhinav Bajaj 

>  

Reply via email to