Recommended Practices for Windows Guests on OpenStack
Assumptions
- Windows version
- Windows 7 & later
- Windows Server 2008 R2 & later
- A KVM hypervisor
General Recommendations
These recommendations are for general Windows performance improvements.
-
Disable the following services:
BDESVCwbengineDPSUxSmsDefragsvcHomeGroupListenerHomeGroupProvideriphlpsvcMSiSCSIswprvCscServiceSstpSvcwscsvcSSDPSRVSysMainTabletInputServiceThemesupnphostVSSSDRSVCWinDefendWerSvcMpsSvcehRecvrehSchedWSearchwuauservWlansvcWwanSvc
-
Tweak the registry:
[HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\Copy To] @="{C2FBB630-2971-11D1-A18C-00C04FD75D13}" [HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\Move To] @="{C2FBB631-2971-11D1-A18C-00C04FD75D13}" [HKEY_CURRENT_USER\Control Panel\Desktop] "AutoEndTasks"="1" "HungAppTimeout"="1000" "MenuShowDelay"="8" "WaitToKillAppTimeout"="2000" "LowLevelHooksTimeout"="1000" [HKEY_CURRENT_USER\Control Panel\Mouse] "MouseHoverTime"="8" [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoLowDiskSpaceChecks"=dword:00000001 "LinkResolveIgnoreLinkInfo"=dword:00000001 "NoResolveSearch"=dword:00000001 -
In any cloud environment with many Microsoft Windows based virtual machines, use a Windows Key Management Service.
- Only active machines consume a license (instead of statically assigning).
- It is easier to track the actual number of Windows licenses in use.
- It makes virtual machine deployment much easier.
CPU Performance
- Try to fit a Windows guest into a numa node.
- In the host BIOS, make sure power management is set to
OS controlorcustom. This allows OS control by usingtuned virtual-hoston the host. - Set the Power Options to the high performance power plan.
- Enable hyper-threading.
Disk Performance
-
Install the
VirtIOdisk class driver. -
Modify the XML file to specify the
VirtIOdevice model, and installVirtIOdrivers in the guest. -
Use raw or QCOW2 disk image file formats.
-
Use pre-allocated raw disk image files. QCOW images cannot be pre-allocated, so this only applies to raw.
-
With QCOW2, preallocating your metadata space will hugely improve performance. This must be performed at the command line:
qemu-img create -f qcow2 -o size=10000000000,preallocation=metadata file.img -
Disable KVM disk caching; allow Windows file system caches to handle this.
-
Disable write-back caching; write-back caching will decrease performance. Write-through caching also affects performance, but not as badly.
Memory Performance
-
Enable Huge pages on the compute node. HugePage memory is locked and cannot be swapped out. To set Huge pages in host:
echo 15000 > /proc/sys/vm/nr_hugepages cat /proc/meminfo | grep Huge mount -t hugetlbfs hugetlbfs /dev/hugepages -
Restart
libvirtafter you mount huge pages:service libvirtd restart -
Enable Kernel Same-page merging module. This allows identical memory pages to be shared amongst virtualized guests and for over provisioning.
-
Reset the virtual memory setting. Make it static, meaning the initial size and max size are the same. Set this large enough to represent your expected workload.
- In the Control Panel, open Advanced System settings.
- Click the Advanced tab and select Performance -> Settings -> Advanced -> Virtual memory.
- Disable
Automatically manage paging file.... - Select
Custom size. - Set the initial size and maximum size.
General Networking
-
Match MTU size with underlying network infrastructure.
-
Install the VirtIO network driver.
-
Disable Windows scaling heuristics.
-
Enable compound TCP.
-
Disable TCP auto-tuning.
netsh int tcp set global autotuninglevel=disabled -
Some systems (though not all) can benefit from some additional network tunning for TCP/IP performance.
REGISTRY KEYS Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters Value Name Value (decimal) TcpTimedWaitDelay 30 MaxUserPort 32768 #minimum TcpMaxDataRetransmissions 5 #seconds TcpNumConnections 16777214 Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters EnableDynamicBacklog 00000001 MinimumDynamicBacklog 00000020 MaximumDynamicBacklog 00001000 DynamicBacklogGrowthDelta 00000010 KeepAliveInterval 1 #seconds Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{Interface GUID}* * {Interface GUID} is different for every system. TcpNoDelay 1 TcpAckFrequency 1
P2V Issues
- Run sysprep after firstboot.
- Using Device Manager, show hidden devices, and uninstall any unused devices.
libvirt Tuning
The libvirt process uses an XML configuration file, located at /var/lib/nova/instances/{UUID}/libvirt.xml.
Editing the exact Windows instance requires knowing the UUID of the virtual machine.
To find virtual machine UUID:
-
Get list of running VMs on compute node:
virsh list -
From the list of running VMs, select the domain ID you're interested in.
virsh dumpxml {domain ID} | grep '<uuid>'
There are several changes that can improve performance:
- Enabing memory backing
- Changing vcpu to pcpu pinning
- Using numatune
- Setting the correct model type
- Setting the cache mode to none
- Setting the I/O mode to native