Friday, March 1, 2013

Optimizing Windows virtual machines for VMware View

Recently I found myself looking back to a VMware View environment I setup to roll out another. I felt it would be helpful to take some of the general steps or considerations I used as a baseline to help others create View Environments. My recommendations are easy and helpful, but may not be ready for production use in all environments. Also what I constitute as a basic office computer, power user computer, or high performance computer may not match your needs. You should use my recommendations and baseline for creating a VM to see the end result and make changes incrementally to get exactly what you are looking for.

If you are deploying View in a high security environment or an environment where special considerations for a LOB app need to be delivered via Citrix or ThinApp, now VMware Horizon View, this article will not go that far in depth. I will cover virtual machine hardware configurations, optimizations for Windows, Group Policy settings, and VMware View tuning. The recommendations and VMware scripts provided to optimize Windows are great, but are a good starting point. 

I hope you find this information helpful. If you have additional configurations or suggestions you would use as a baseline for a View environment I'm interested to hear what they are.

Configuring your VMs
Configuring the VMs is pretty straight forward if you're already familiar with vSphere. Depending on video play back and any animations you want to provide you will need to tweak video settings. Below is the hardware I used for configuring virtual machines. I tiered my virtual machines as basic office computer, power user computer, and high performance computer. For all of the machines I used a Windows 7 64 bit virtual machine, removed the floppy, and converted to a template. One template for each of the type of machines configurations below.

Basic Office Computer
Memory 2 GB, CPUs 1 socket 1 core, 4 MB of video memory, LSI Logic SAS controller, 32 GB hard disk.

Power User Computer
Memory 2 GB, CPUs 2 socket 1 core, 64 MB of video memory, LSI Logic SAS controller, 32 GB hard disk.

High Performance Computer
Memory 4 GB, CPUs 2 socket 1 core, 128 MB of video memory, LSI Logic SAS controller, 32 GB hard disk.

From the list above you can see really there aren't many difference. The only really big difference was the video and operating system memory because those users required flash video play back and multimedia. The Power User Computer VM template needed a second CPU for a LOB app that needs a little more processing power, and of course the majority of the deployment is to provide basic office computers to users who have limited needs.

Optimizing Windows for performance
One of the biggest issues with VMs is always end user experience. On one side users want to be able to customize their computer, but you need to disable things like Aero, Windows Defender, Windows Animations, etc in order to optimize the virtual machines for performance. The end result should be a computer that the user can't tell is virtualized. That being said hopefully you're using hybrid storage with flash drives as well as traditional disk to optimizing read and write performance.

First save the VMware scripts included in the PDF that you can find HERE. You will find three scripts called CommandsPersonaManagement.txt, CommandsNoPersonaManagement.txt, and CommandsDesktopsReadyForPersonaManagement.txt. I'm not going to go into the other two related to Persona Management so if you're following this blog and testing use CommandsNoPersonaManagement.txt. This will however require you to setup roaming profiles through Group Policy, or else have local profiles across all of your View VMs. Either is fine for testing. You should use Persona Management as it far exceeds roaming profiles and solves many issues with local and roaming profiles. I will not go into that, but you can find all of the information you need regarding Persona Management HERE.

Before you run the CommandsNoPersonaManagement.txt script you should exclude the two lines "Powershell Set-Service ‘UxSms’ -startuptype “disabled”" and "Powershell Set-Service ‘Themes’ -startuptype “disabled”". If you do not the scripts will force the Windows Classic theme. Copy the script to your VM, rename the extension BAT, and run from an administrative command prompt.

Group Policy Settings
Below are a few Group Policy settings I use to force a basic Windows 7 experience without specifying an actual theme. This takes away many of the Windows 7 Aero experiences so it does not bog down video rendering for the things that really matter. I actually do specify a theme but you have to create one first so I did not provide that setting below.

User Configuration > Administrative Templates > Control Panel > Personalization
Prevent changing desktop background (enabled)
Password protect the screen saver (enabled)
Screen saver timeout (enabled, 900 seconds)

User Configuration > Administrative Templates > Desktop
Desktop Wallpaper (enabled, select wallpaper)

User Configuration > Administrative Templates > Windows Components > Desktop Window Manager
Do not applow window animations (enabled)
Do not applow desktop composition (enabled)

Last, Install View Agent, and applications.

VMware View Administration Console Pool Settings
When you create a View pool there are a number of options you can set but we are only paying attention to those that enhance performance. While there are many things you can do to enhance View performance, we will only talk about the mainstream built in View performance tweaks.

First enable host caching. When you first install VMware View you will need to add a vCenter server. When you are adding one you will get an option to enable host caching. If you added vCenter already and need to edit those settings in the View Administrator Console to go View Configuration > Servers and edit the vCenter server you added. The host caching options will be on the host caching tab. I would recommend setting to 1024 and go up and down from there based on needs. Ideally your cache should be placed on SSD drives for maximum performance although any disk that isn't heavily used will work fine.

Next either create a new View pool or edit an existing one. When creating a new pool you can set the caching in the Advanced Storage section, or edit an existing pool and edit the settings on the Advanced Storage tab. This is also where you can configure blackout times, and regeneration. Be aware that if you do not configure blackout times you could find desktops in your View pool being unavailable at an inopportune time. Both blackout times and regeneration are specific to your needs and user schedules. More information about host cache can be found HERE.

Moving on, configure the Remote Desktop Power Policy to ensure desktops are always powered on, and automatic logoff so that a single user cannot tie up a virtual machine too long. Next force PCoIP, and do not allow users to select a protocol. Doing so will allow you to enable Windows 7 3D rendering. Per the three VM templates I created, I also created three pools. The first pools is set to 4 MB of video ram, the second 64 MB, and the last 128 MB. 128 MB is ideal for flash video. The Adobe Flash settings will vary for your environment but in all but the high performance pool I set flash quality to medium, and the throttling to moderate. On the high performance pool I used the high quality setting with no throttling.

You can find more on VMware View with PCoIP features and recommended settings HERE.