Introduction
Viewing historical resource consumption data helps cloud users and operators to easily identify bottlenecks or the over-provision of resources, allowing resource owners to estimate and analyse performance. CloudStack already allows for retrieval of metrics data for various resources (eg. Zones, Hosts) and for Instances and their Volumes, but does not display the data in a simple graph.
This improvement expands the available historical metrics data to include user Instances, system VMs and Volumes. Furthermore, a Metrics tab has been added for each of these resources where users can see the data in multiple, interactive graphs. With this improvement, cloud users and operators can gain valuable insights into the performance of CPU, memory, disk IO and network historical statistics.
Inside the feature
To facilitate the storage of historical statistics for various resources, changes have been implemented in the CloudStack management server and database. Specifically, new database tables have been added to store this data, and regular clean-up processes have been established to prevent the database from becoming overly bloated. It should be noted that the availability of metrics for a particular resource depends on the existing hypervisor metrics support within CloudStack, as the management server collects this data from the underlying hypervisor.
To retrieve statistical data from the server, the following APIs have been introduced:
API call | Description | Release |
listVirtualMachinesUsageHistory | Historical statistics for user instances | 4.17 |
listSystemVmsUsageHistory | Historical statistics for system VMs | 4.18 |
listVolumesUsageHistory | Historical statistics for instance volumes | 4.18 |
To enable the retention of resource statistics and specify their duration, use the corresponding global configurations. The following global configurations can be used to enable and store historical statistics:
Variable | Description |
vm.stats.max.retention.time | The maximum time (in minutes) for keeping VM stats records in the database. The VM stats cleanup process will be disabled if this is set to 0 or less than 0. The default value is 720. |
vm.stats.user.vm.only | When set to ‘false’ stats for system VMs will be collected otherwise stats collection will be done only for user VMs. The default value is ‘false’. |
vm.disk.stats.retention.enabled | When set to ‘true’ stats for VM disks will be stored in the database otherwise disk stats will not be stored. The default value is ‘false’. |
vm.disk.stats.max.retention.time | The maximum time (in minutes) for keeping Volume stats records in the database. The Volume stats cleanup process will be disabled if this is set to 0 or less than 0. The default value is 720. |
By default, Volume or Disk statistics are not enabled. To enable both, change the following global setting:
Variable | Description |
vm.disk.stats.interval | Interval (in seconds) to report VM disk statistics. VM disk statistics will be disabled if this is set to 0 or less than 0. |
Conclusion
The release of CloudStack 4.18 includes this improvement. Resource owners are now able to view historical statistics for their resources in graph form, which aids in troubleshooting and analysing performance. While this is a significant advancement, there is always scope for improvement, whether it involves enhancing the hypervisor plugin or expanding the visualisation framework to cover other resources and entities.
Abhishek Kumar is a software engineer by profession. His personal interests and hobbies are technology, politics and sports. Abhishek is experienced in development and management of a variety of desktop and mobile applications. He has a particular interest in mobile application development, designing and developing highly interactive and intuitive mobile, desktop applications GUI.
Abhishek became part of ShapeBlue in 2019 and is currently an active Apache CloudStack Committer.
You can learn more about Abhishek and his background by reading his Meet The Team blog.