Best practices are the most obvious starting point for improving your Hyper-V and Virtual Machine performance and I’ve listed 23 of them for you below.
Did I miss out on any? Leave a comment and let me know!
1. Avoid overloading Hyper-V Server
You must not overload Hyper-V Server. In other words, there is no need to host and run virtual machines which have no functions or I would say you just should not configure and install virtual machines for the sake of it. It is because VMMS.exe needs to maintain the status of all virtual machines including virtual machines which do not perform any business function.
2. Avoid creation of multiple Virtual Network Switches
VMMS.exe, running as Hyper-V Virtual Machine Management Service, keeps track of virtual switches created and the communication between virtual machines. You must always use the VLAN Tagging or other isolation mechanisms to separate communication between virtual machines instead of creating a virtual switch.
3. Configure antivirus software to bypass Hyper-V processes and directories
Antivirus software performs I/O operations for files being accessed by the Operating System and Hyper-V processes. You must alter the Antivirus configuration to exclude Hyper-V main processes and other directories as listed below:
- Hyper-V Processes: VMMS.exe and VMWP.exe
- All folders containing the Virtual Machine Hard disk files and configuration.
- Snapshot/checkpoint folders.
- Cluster Shared Volumes for path C:\ClusterStorage
4. Avoid Mixing Virtual Machines that can or cannot use Integration Service components
There are two types of virtual machine communication taking place on the Hyper-V Server 1) communication using VMBUS design 2) communication using emulation. The former is faster and is available only if you install the Integration Components in the virtual machine. In case if you need to run a virtual machine which is not supported by the Hyper-V or Integration Services cannot be installed, it is recommended to follow below guidelines:
- If you have a free Hyper-V Server, then install such virtual machines on that Hyper-V Server.
- If you do not have a free Hyper-V Server, then connect such virtual machines to a separate Hyper-V virtual switch.
5. Avoid storing system files on drives used for Hyper-V storage
You must not store Hyper-V virtual machine files on drives used by the Operating System. It is because of the I/O operation. Drives, where the system files are stored, are accessed by the system processes continuously and this might cause delay in processing the Hyper-V tasks.
6. Use separate volumes for each VM
Since the administrative tasks of a virtual machine are controlled by its own process (VMWP.exe), keeping several virtual machines on a single volume will cause more Disk I/O operations from each worker process. Hence, it is recommended to use separate volumes for storing virtual machine files (VHD, VHDx, checkpoints, and XML).
7. Avoid single point of failure for network adapters using NIC Teaming
Windows Server 2012 and later operating systems support NIC teaming. You must ensure that the NIC teaming is configured for the host operating system. Virtual Machines can also be configured to use the NIC Teaming feature.
8. Always use Network Isolation Mechanism rather than creating a separate virtual switch
When you come across any networking requirement that needs to be configured on Hyper-V Server, use the order of preference that is listed below to achieve the configuration you need. The best way is to use the “Hyper-v Virtual Network Switch and VLAN Tagging” method. Other methods can also be used depending on your requirements, but consider them in this order:
- Hyper-V Virtual Switch and VLAN Tagging Method
- Hyper-V Virtual Switch Method
- Firewall Method
- Different subnet Method
- Another Physical NIC Method
9. Install Multiple Network Interface cards on Hyper-V Server
There are multiple types of communication taking place in the Hyper-V. For example, communication between virtual machines, communication between virtual machines and parent and communication to manage these virtual machines from a management console. It is always recommended to dedicate a network interface card for managing virtual machines and Hyper-V host. Use of fabric resources is considered nowadays.
10. Always use supported guest Operating Systems
VMBUS and VSP/VSC components are part of the Integration Services which help in improving the performance of communication between virtual machines and parent partition. Integration Components can be installed only on the Supported guest operating systems. Hence, please only install operating systems which are supported. A list of supported Guest Operating systems can be found here http://support.microsoft.com/kb/954958
11. Always use Generation Type 2 Virtual Machines
“Generation Type 2” feature was introduced with Windows Server 2012 R2. Previously, normal virtual machines allowed booting from IDE controller only, but with Generation Type 2, you can boot virtual machines from a SCSI controller, which is much faster than a virtual machine booting from an IDE controller. “Generation Type 2” virtual machine uses VMBUS and VSP/VSC architecture at the boot level, which improves overall performance of the virtual machines. “Generation Type 2” feature also allows paging file to be relocated to a SCSI controller.
12. Always change the default location for storing virtual machine configuration and VHD files
By default, when you enable the Hyper-V Role for the first time, the Hyper-V server is configured to store the virtual machine configuration and VHD files on the local storage under C:\ProgramData\Windows\Hyper-V\Virtual Machines folder. You must change this location to appropriate drives before the Hyper-V servers are moved to the production environment.
13. Monitor performance of Hyper-V Server for optimization
There are several Hyper-V performance counters available which you can use to monitor the performance of the Hyper-V Server, virtual machines, network communication, etc. Please make use of these performance counters and fix any issues with the performance.
14. De-fragment Hyper-V Server regularly or before creating a virtual hard disk
It is advisable to defrag Hyper-V Server disks where the VHD and virtual machine configuration files are stored regularly or before creating a large virtual hard disk file.
15. Always install the Integration Components on the supported virtual machines
Integration Components provide VMBUS and VSP/VSC design to improve the performance of virtual machines running on the Hyper-V Server. Always install the Integration Components on supported Guest operating systems. For Linux distributions, there are separate IC versions available which you can download from Microsoft site.
16. Always use Fixed VHD files
If storage is not an issue to get better performance for resource intensive applications, it is recommended to deploy virtual machines over Fixed VHD files instead of using Dynamic VHD files.
17. Use Dynamic Memory Feature
Although, the Dynamic Memory feature does not help directly in achieving better performance of the virtual machines, but it allows you to balance the allocation of memory resource dynamically. It is recommended to configure Dynamic Memory parameters for each critical virtual machine running on a Hyper-V server.
18. Configure SCSI disks for Data volumes
Since SCSI is faster than IDE, it is recommended to relocate data volume disk on a SCSI controller. For resource intensive applications like SQL Server, it is always recommended to keep Log and data disk files on separate SCSI controllers.
19. Relocate paging file to a SCSI Disk Controller
For applications running inside virtual machines which requires frequent paging operation, always relocate paging file to a SCSI Controller virtual hard drive. Paging file can be relocated to a SCSI controller if you are running “Generation Type 2” Virtual Machine.
20. Always exclude Paging file for virtual machines participating in Hyper-V Replication
If you have enabled Hyper-V Replication for virtual machines, make sure to exclude paging file from replication. Applications running inside virtual machines may do frequent paging operation and this may cause paging file contents to be replicated which are unnecessary.
21. Implement Hyper-V in Server Core in Production environment
Since Windows Server Core Operating System does not have a GUI, it consumes less resources. It is recommended to enable Hyper-V on a Windows Server Core installation rather than using a full version of Windows Operating System.
22. Close unnecessary Windows
Please make sure to close the following windows on Hyper-V server so the system resources are available to Hyper-V processes:
- Virtual Machine Connection Window: Always remember to close Virtual Machine connection window, once your task to the virtual machine is completed. Keeping the virtual machine connection window opened consumes system resources which could be utilized for other purpose by the hypervisor.
- Minimize Hyper-V Manager Window: Keeping the Hyper-V Manager window opened also consumes system resources. So close it after your task is over.
- Any other Application Window: Make sure to close all other application windows on Hyper-V Server so the enough system resources are available to the hypervisor.
23. Use Certified Hardware
Microsoft developers spent a lot of time in testing the server applications on the specific hardware. It is recommended that we use only certified hardware, whenever possible. The list can be found here: www.windowsservercatalog.com