Introduction

In todays cloud (public) business delivering descent disk I/O performance is still a challenge. For cloud/system administrators it is important to know which instances are causing the most disk I/O.

This might not be very important in private clouds, but in public clouds it is important to be able to set boundaries for customers and/or bill based on disk I/O.

Goal

Add disk I/O polling for instances to CloudStack. Add it to the instance statistics and add it to the usage database for optional billing in public clouds.

Both IOps and bandwith should be supported.

If a instance has multiple disks, it should be possible to see the IOps per disk.

The goal is not to take over the (performance) monitoring tasks of the underlying SAN/NAS.

Target version

CloudStack 4.2

Hypervisors

Support should be added to all hypervisors which support disk I/O polling.

When a hypervisor doesn't support polling of IOps or bandwith, set the values to 0 by default.

If a hypervisor doesn't support polling per-disk, but just per instance, return stats for just the root disk.

KVM (Done)

This is supported through libvirt. Per disk it is possible to poll IOps and Read/Write bandwith.

VMWare (TBD)

Xen (Done)

Existing issue:

xepapi returns bytes per seconds instead of total I/O.

OVM (TBD)

Changes

a summary:

Database

CREATE TABLE `cloud`.`vm_disk_statistics`
CREATE TABLE `cloud_usage`.`vm_disk_statistics`
CREATE TABLE `cloud_usage`.`usage_vm_disk`

INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.disk.stats.interval', 0, 'Interval (in seconds) to report vm disk statistics.');

StatsCollector (change)

Add the processing of disk Input/Output operations as well of disk bandwith (R/W).
_executor.scheduleAtFixedRate(new VmDiskStatsTask(), vmDiskStatsInterval, vmDiskStatsInterval, TimeUnit.SECONDS);

VmStatsEntry (change)

Change VmStatsEntry object, add some new fields related to disk I/O:

  • double diskReadIOs;
  • double diskWriteIOs;
  • double diskReadKBs;
  • double diskWriteKBs;

VmDiskStatsEntry (new)

Add a new object VmDiskStatsEntry which contains:

  • String vmName;
  • String path;
  • Long ioRead;
  • Long ioWrite;
  • Long bytesWrite;
  • Long bytesRead;

Usage Server

The usage server's database should be modified to also store this data.

UsageTypes

public static final int VM_DISK_IO_READ = 21;
public static final int VM_DISK_IO_WRITE = 22;
public static final int VM_DISK_BYTES_READ = 23;
public static final int VM_DISK_BYTES_WRITE = 24;

UsageManagerImpl

createVmDiskHelperEntry
VmDiskUsageParser