The QoS policy was a feature included in Windows Server 2012 R2 that enabled to set a minimum and a maximum IOPS on a VHD(X). These policies were not centralized and you had to set the QoS policy on each VHD(X) independently.
In Windows Server 2016, Microsoft has improved this feature because the policy can now be stored in the cluster database. You can create a policy based on a minimum / maximum IOPS and/or a bandwidth. This policy can be applied to a VHD(X) (Dedicated Policy Type) or to a set of VHD(X) (Aggregated policy Type).
With the dedicated policy type, the storage QoS is applied to individual VHD(x). That means that if you create this type of policy with a minimum of 400 IOPS and a maximum of 500 IOPS, this VHD(X) is sure to have at least 400 IOPS and no more than 500 IOPS.
In the other hand, with the Aggregated policy, the storage QoS is applied to a set of a VHD(x). If you apply the same policy than above and if you apply the policy to 10 VHD(X), these VHD(x) will have 50 IOPS on high demand maximum.
The Storage QoS policies can be managed with or without Virtual Machine Manager 2016 but in this topic I’ll show you how to manage storage QoS policies from VMM.
Create the QoS policies
To create the QoS policy from VMM, navigate to the Fabric tab and click on QoS Policies.
Then you can create a QoS policy. I call mine Bronze.
Then you can configure the policy settings by choosing the policy type (dedicated or aggregated), the Minimum IOPS, Maximum IOPS and the bandwidth. When you set a 0 value, this means unlimited.
Then you can choose the storage arrays where the policy will be used.
I have created two dedicated storage QoS policies called Bronze and Gold.
If I use PowerShell, I can retrieve these storage QoS policies:
1 2 3 |
$Cim = New-CimSession -ComputerName Cluster-Hyv01 Get-StorageQosPolicy -CimSession $Cim |
Apply the storage QoS policies
To test the storage QoS policies, I will work on a VM called VMDPM01 (this is my DPM server which is a fresh install of a Windows Server 2016 TP5 without any other installations). First I verify that no storage QoS policy is applied to any VHDX of this VM:
1 2 3 4 5 |
Get-VM -ComputerName Cluster-Hyv01 -Name VMDPM01 | Get-VMHardDiskDrive | fl VMName, Path, QoSPolicyId |
As you can see above, no storage QoS policy is applied to each VHDX. Now I apply the Gold policy on _Template2016TP5.vhdx and Data.vhdx, and the Bronze policy on Backup.vhdx. To make this operation, I edit the VM properties from VMM console and I navigate to advanced on each VHDX (hardware tab).
Once you have finished setting the storage QoS policies, you can run again this command to check if the policies are applied:
1 2 3 4 5 |
Get-VM -ComputerName Cluster-Hyv01 -Name VMDPM01 | Get-VMHardDiskDrive | fl VMName, Path, QoSPolicyId |
As you can see in the above screenshot, the storage QoS policies are well applied. By running the following command, I can get the current IOPS and the Maximum IOPS allowed for each VHDX:
1 2 3 4 5 |
$Cim = New-CimSession -ComputerName Cluster-Hyv01 Get-StorageQoSFlow -CimSession $Cim |? InitiatorName -Like VMDPM01 | ft FilePath, InitiatorIOPS, MaximumIOPS |
Now I run IOMeter in the VM to make a high demand on the VHDX. The IOPS don’t exceed the Maximum IOPS set from the storage QoS policy.
Then I change the storage QoS policy of the _Template2016TP5.vhdx to bronze policy. Now the MaximumIOPS are set to 500. Next I run again the above command and as you can see, the IOPS don’t exceed (or not so much J) the Maximum IOPS.
Unapply the storage QoS policies
To remove the storage QoS policy, you can edit again the advanced properties of the VHDX and set to 0 the Maximum IOPS.
Now I run again the following PowerShell cmdlet:
1 2 3 4 5 |
$Cim = New-CimSession -ComputerName Cluster-Hyv01 Get-StorageQoSFlow -CimSession $Cim |? InitiatorName -Like VMDPM01 | ft FilePath, InitiatorIOPS, MaximumIOPS |
As you can see, now there is no limit, the VHDX can take a lot of IOPS.
Conclusion
Storage QoS policy is a good feature to limit some virtual machines IOPS. This enables to avoid that a VM takes all storage resources and impact another VMs. This is great when you have a multi-tenant environment to avoid that a customer impacts the performance of another. Moreover, thanks to storage QoS policy you can make a service offer. For example, you can create policies for low performance (300 IOPS), standard performance (500 IOPS) and premium performance (8000 IOPS) as another well-known public service (its name begins by “A” and finish by “zure”).