On a 4xCPU multi-processor Linux server the CA APM agent metric "CPU:Utilization % (process)" consistently shows a much lower value compared to the CPU utilization reported by the "top" command for the agent/java process.

Document ID : KB000048158
Last Modified Date : 16/07/2018
Show Technical Document Details
Issue:

On a 4xCPU multi-processor Linux server the agent metric "CPU:Utilization % (process)" consistently shows a much lower value compared to the CPU utilization reported by the "top" command for the agent/java process.

Environment:
APM 9.x, 10.x
Cause:

The agent metric for process CPU is always averaged across all CPUs.  On a multi-processor Linux server if top is run in default mode (Irix is on) the %CPU is the grand total across all CPUs (not averaged). 

Resolution:

Therefore for a better comparison with the "CPU:Utilization % (process)" metric it is better to run top in Solaris mode by toggling the Irix mode off using the interactive "I" option.

    Additional Information:

    These steps describe how the agent captures CPU metrics:

    1. For CPU metrics the agent samples every 2.5 seconds using the Unix System API calls.
       
    2. The agent collects the total CPU usage for its running JVM process i.e. agent + all other AppServer processing within that JVM.
       
    3. The agent process CPU is divided by the total CPU value (of all CPUs) to get the agent process usage share of the CPU (then multiplied by 100 to get the percentage.)