As we are approaching the holidays, and being busy preparing for the new year! I would like to share a script with you.
In This Article
Hyper-V Storage QoS!
Killer feature… Microsoft introduced in Windows Server 2012 R2, Hyper-V storage Quality of Service (QoS). Storage QoS enables you to manage storage throughput for virtual hard disks that are accessed by your virtual machines.
Storage QoS enables you to specify the maximum and minimum I/O loads in terms of I/O operations per second (IOPS) for each virtual disk in your virtual machines. Minimum and maximum IOPS are measured in 8 KB increments,
Now If you are concerned about a specific virtual hard disk for a particular VM is not receiving sufficient disk I/O, then you can set a minimum IOPS level. Remember that minimum is a soft reserve (best effort) which means it might fail but an event will be logged that things are going wrong. On the other hand, if the virtual hard disk is accommodating a very high I/O then you may want to populate the Maximum IOPS field as a way of limiting the total number of IOPS that the virtual hard disk can consume, and ensure that the storage throughput of one virtual hard disk does not impact the performance of another virtual hard disk on the same Hyper-V host.
For more information on what’s new in Storage QoS in Windows Server 2012 R2, check here.
Best Practices: Hyper-V Storage QoS!
If you identify a VM that is using more resources than you want it to use, then you can go ahead and apply a limit to it right away, this what we call a reactive approach.
To measure a VM, you can use Measure-VM cmdlet but first you must enable VMResourceMetering. The virtual machine metrics infrastructure have been extended with storage related attributes in Windows Server 2012 R2, so you can monitor the performance. To do this Microsoft use what they call “normalized IOPs” where every 8K of data is counted as an I/O.
The reactive approach is not really ideal, because you are reacting since you have a problem.
What I recommend doing is to take a proactive approach earlier.
So as you are deploying your virtual machines, you can start applying a default limit to all individual VM’s VHDs and then you can raise based on workload demand.
As best practices, consider tiers based on planned usage as Virtual Machines are deployed as the following:
- VDI VMs: Max 100 IOPs limit
- General VMs: Max 500 IOPs limit
- High Performance VMs: > 500 IOPs limit
How can you limit individual VM’s VHD?
The answer is straight forward, the new Storage QoS feature is available under Advanced Features for each individual virtual hard drive as shown in below figure:
Automation: Hyper-V Storage QoS!
Now the challenging question is what if you have hundreds of VMs already deployed and you need to start using the proactive approach?
The answer is simple, open each VM settings and limit the maximum IOPs to 500.
And what if each VM has 4 virtual hard disks attached to it? so 400 VHDs.
The answer is PowerShell of course!
I created the following tool script that will help you to limit all individual VM’s VHDs to a default IO number you specify.
<# .SYNOPSIS Set Storage Quality of Service for all Virtual Machines. .DESCRIPTION Set Minimum and Maximum Storage Quality of Service for all Virtual Machines. .NOTES File Name : Set-VMStorageIO.ps1 Author : Charbel Nemnom Version : 1.1 Requires : PowerShell Version 4.0 or above OS : Windows Server 2012 R2 Hyper-V or Free Hyper-V Server 2012 R2 .LINK To provide feedback or for further assistance please visit:
Here you so go Hyper-V storage QoS Maximum IOPs is set for all virtual machines, I feel it’s a much easier than having to set the limit individually for each VM’s VHD.
If you have more scenarios, please feel free to leave a comment below:
Demo: Hyper-V Storage QoS!
Would you like to see Hyper-V Storage QoS in action? Then make sure to watch this short demo:
And now It’s time to sign-off and prepare for the holidays…
See you in 2015!
Enjoy the holidays…