Saturday, January 21, 2012

Speeding up VMs - Services you can disable

Modern day computers have no problems running multiple copies of Windows XP in virtual machines. However, this doesn't mean we don't want to use the host machine. Making sure Windows XP is as slim as possible is key to achieving this.

I routinely disable the following services and make these changes to nearly every Windows XP VM I create. These are considered "safe" to turn off. Since I'm only using these VMs for TF2 idling, I can go a bit crazy, I'll talk about those later.

The following services are set to "Manual"

Automatic Updates
Background Intelligent Transfer Service
Help and Support
Windows Firewall/Internet Connection Sharing
Security Center
Remote Registry

Set to Disabled
Print Spooler (Doubt you'll print from this VM)
Wireless Zero Configuration (No need to explain)
System Restore Service (You are cloning a template right?)
IMAPI CD-Burning COM Service (VMware will allow the VM to see your burner turning this on every time)

Also disabled in 'MSCONFIG'
You can never be too sure...

Indexing Service
Error Reporting Service
Event Log
Help and Support
NetMeeting Remote Desktop Sharing
Print Spooler
Security Center
Automatic Updates
Wireless zero conf

Indexing Service

Another very important thing (Most likely THE most important item to disable in a virtual environment) is the indexing service. This little resource hog continuously monitors your disk drives for minor file changes, eating a huge amount of IOPS (in/out operations per second) for a virtual machine.
There are two things to change.
In Services, fine indexing and change it to DISABLED
Then go to my computer, disk properties of the C drive, and uncheck "Allow Indexing Service" and apply to all of C:\ and sub folders. This may take a little bit. Click Ignore all when it attempts to modify a locked file.  This alone will speed things up greatly.

Virtual Memory Allocation

Virtual memory allows your computer with low physical ram to swap out some of that to disk, effectively making Windows think you have more memory than you do. We need this, but not in the way Windows XP handles it by default. Resizing the virtual memory file takes a LOT of resource, and when you run low on RAM, which you will when loading HL2.exe (Not during execution however) you will need some amount of virtual memory to get it running. Since the largest performance hit (outside of virtual memory itself, but thats another discussion) is the automatic resizing of the swap file itself. We can fix this by...

  • Right Click My Computer
  • Advanced Tab
  • Settings Button
  • Advanced Tab
  • Virtual Memory Settings Button
  • Select Custom Setting
  • Set Minimum to 512
  • Set Maximum to 512
  • Press 'Set'
  • Click OK
  • Restart the VM

I used 512mb in this example, and should be the minimum for a TF2 idle VM. If you find the VM or host running slower try playing with this number. You can also make sure Workstation itself is handling ram the way you need it to as well, see below for more.

Workstation Virtual Memory Swaping

Another way to speed up your VMs is to change the way workstation handles the memory allocated for each VM. There are three options:

Fit ALL virtual machine memory into reserved host ram.
Allow SOME virtual memory to be swapped. (Default)
Allow MOST virtual memory to be swapped.

Without going into detail about how swapping works, think of each option as a speed gauge from fastest to slowest, fastest being fit ALL virtual memory. You can shove more virtual machines running with the 'most' option, however everything will grind so slowly your host and guest machines will be nearly unusable if you have too many going. If you try to fit all virtual memory, they'll be fast and responsive, however you'll leave much less for the host machine to use. Try all of them and see which one is best.

This is a decent start, there are many other things you can do of course.

No comments:

Post a Comment