kioie opened a new issue #3471: CPU utilization seems to be inconsistent
URL: https://github.com/apache/cloudstack/issues/3471
 
 
   <!--
   Verify first that your issue/request is not already reported on GitHub.
   Also test if the latest release and master branch are affected too.
   Always add information AFTER of these HTML comments, but no need to delete 
the comments.
   -->
   
   ##### ISSUE TYPE
   <!-- Pick one below and delete the rest -->
    * Bug Report
    
   ##### COMPONENT NAME
   <!--
   Categorize the issue, e.g. API, VR, VPN, UI, etc.
   -->
   ~~~
   CPU utilization
   ~~~
   
   ##### CLOUDSTACK VERSION
   <!--
   New line separated list of affected versions, commit ID for issues on master 
branch.
   -->
   
   ~~~
   4.11+
   ~~~
   
   ##### CONFIGURATION
   <!--
   Information about the configuration if relevant, e.g. basic network, 
advanced networking, etc.  N/A otherwise
   -->
   
   
   ##### OS / ENVIRONMENT
   <!--
   Information about the environment if relevant, N/A otherwise
   -->
   
   
   ##### SUMMARY
   <!-- Explain the problem/feature briefly -->
   CPU utilization metrics seems to be inconsistent with the actual CPU usage 
in the VM. The error seems to be generated from this `getVMStat` method in the 
`LibvirtComputingResource` class
   ```
    /* get cpu utilization */
               VmStats oldStats = null;
   
               final Calendar now = Calendar.getInstance();
   
               oldStats = _vmStats.get(vmName);
   
               long elapsedTime = 0;
               if (oldStats != null) {
                   elapsedTime = now.getTimeInMillis() - 
oldStats._timestamp.getTimeInMillis();
                   double utilization = (info.cpuTime - oldStats._usedTime) / 
((double)elapsedTime * 1000000);
   
                   final NodeInfo node = conn.nodeInfo();
                   utilization = utilization / node.cpus;
                   if (utilization > 0) {
                       stats.setCPUUtilization(utilization * 100);
                   }
               }
   
   ```
   
   ##### STEPS TO REPRODUCE
   <!--
   For bugs, show exactly how to reproduce the problem, using a minimal 
test-case. Use Screenshots if accurate.
   
   For new features, show how the feature would be used.
   -->
   
   <!-- Paste example playbooks or commands between quotes below -->
   ~~~
   Run stress test on the VM with 100% cpu utilization then confirm VM Metric 
on the statistics tab 
   ~~~
   ![Screen Shot 2019-07-05 at 10 13 41 
AM](https://user-images.githubusercontent.com/20902920/60705523-009b9480-9f10-11e9-9032-5c8e65a193a6.png)
   
   ![Screen Shot 2019-07-05 at 10 13 21 
AM](https://user-images.githubusercontent.com/20902920/60705622-3e98b880-9f10-11e9-9fae-afdf059c6181.png)
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   <!-- What did you expect to happen when running the steps above? -->
   
   ~~~
   CPU utilization should be equally as high
   ~~~
   
   ##### ACTUAL RESULTS
   <!-- What actually happened? -->
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   CPU utilization is inconsistent i.e 8.4% (as shown)
   ~~~
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to