Microsoft® has published recently Performance Tuning for Hyper-V Servers on msdn. This guide is one of many other guidelines that cover Performance And Tuning Guide For Windows Server 2012 R2.
As a virtualization addict, Performance tuning for Hyper-V is a top priority to make sure that I am getting the maximum horse power possible 🙂
In Part 1, I will show how to tune your VM by moving the paging file to another Virtual Disk.
As a rule of thumb, your Virtual Machine Guests in Hyper-V should be treated like any other Operating System installed in a physical world. They should be updated, monitored, and fine-tuned for performance, etc… (Don’t forget to use the Best Practices Analyzer for Hyper-V built-in in Server Manager as well!)
We want to focus on Creating a Virtual Disk to store the Paging File (Pagefile.sys), just like a physical box, the virtual machine can gain performance by moving the Paging File off of the boot C drive. This can be achieved as the following:
1) Shutdown your Virtual Machine first.
2) Create a Fixed Virtual Hard Disk that is 1.5 X the amount of RAM your Virtual Machine is using as per Microsoft® Best Practices. Example, if your VM has 12 GB allocated to it, your Fixed Disk would be 18 GB (I prefer to set it 2 times the amount, so it would be 24 GB). If you can store the Fixed Disk on a really fast drive, such as an SSD or SAS HDD 15K the better will be. It is important to note that the best gains will be achieved by having this fixed virtual disk (VHDX) on a separate physical disk/controller than your boot virtual disk.
3) Attach the Fixed Virtual Disk to your Virtual Machine as an IDE to the second IDE Controller (IDE Controller 1) if your Virtual Machine is Generation 1 or attach it to the second SCSI Controller in case your Virtual Machine is Generation 2.
Note: For Generation 1 Virtual Machines, It is critical that you attach the disk as an IDE and not SCSI because the SCSI controller is synthetic and the VM cannot boot from it.
I like to use Generation 2 when possible, it is my favorite.
4) Start up your Virtual Machine.
5) With the Fixed Virtual Disk (Paging File) now in place, you can move the page file by the following:
– Right click on Computer and select Properties, then select Advanced system settings.
– Under the Advanced tab, in the Performance section, select Settings.
– Under the Advanced tab of Performance Options in the Virtual memory section, select Change.
– Uncheck “Automatically manage paging file size for all drives”.
– Set a Custom Size of 1.5 X your VM memory (or 2 times in my case) on the Fixed Disk you determined to use as your Swap Page Drive. The Initial and Maximum Size should be the same. Example: If 12 GB is 2 times your physical memory, set the Initial and Maximum to 24 GB @ 24,576MB.
– Reboot your Virtual Machine.
– IMPORTANT NOTE: Upon your VM is rebooted, go back to the Virtual memory settings and make sure to leave at least 16 MB (by setting the Initial and Maximum Custom Size to 16 MB) on the boot C drive for paging. While we are moving the primary load to another disk, you may need this in case your Page Drive becomes unavailable!
– Reboot one final time and enjoy the increased performance 🙂
Note: If you are using Hyper-V Replica then make sure to exclude the paging file of Windows guest OS from replication. This will allow you to avoid needless replication of this constantly changing file.
The Total Paging file is equal now to 24,576MB (24GB) + 16MB = 24,592MB
So stay tuned for Part 2, until next time… Enjoy your day!