Microsoft Virtual PC 2004 (VPC) is a software virtualisation tool that lets you run multiple guest operating systems within virtual machines on a single computer running Windows XP Professional or Windows 2000 Professional as a host operating system. Here are seven tips on how you can get the best performance from your VPC setup.
Run your host OS on appropriate hardware.
The minimum hardware requirements for VPC are listed here, but you should try to exceed these requirements by a large margin for best performance: that is, a fast CPU, lots of RAM, and good hard drive subsystem.
My own VPC test machine is server-grade hardware, a 3.2-GHz P4 with 2GB of RAM and hardware RAID. I initially thought of using a dual-processor machine for testing but unfortunately VPC will use only one CPU on an SMP machine, though VPC's big brother Microsoft Virtual Server 2005 can make use of multiple processors -- see here for a comparison of the different features of VPC and VS. My only hurdle in getting things up and running was the RAID drivers for my machine weren't compatible with XP (the hardware is certified for Windows Server 2003 but not Windows XP) but I was able to obtain a driver for a newer version of my RAID controller from the manufacturer that let XP recognise the SATA drive system during setup.
Store your VHDs on a separate drive.
VPC disk images (.vhd files) should be stored on a separate drive from your host operating system to get best performance. And again, hardware RAID can improve even further on this. I have three 80GB SATA drives in my test system with my XP host operating system on the first drive and the other two drives configured as RAID 0 (disk striping) for top performance. I also partition my first drive so I can multi-boot my box to other platforms I'm testing and which may not work so well running under Virtual PC.
Use your host operating system exclusively for running VPC.
Any programs or services running on your host operating system will drain CPU cycles away from your virtual machines, so don't use your host operating system for anything other than providing a platform for running your virtual machines on. Disable any services on your host operating system like the indexing service that can be processor-intensive. Not running anything unnecessary on your host operating system is especially important when you're installing a guest operating system to create a new virtual machine. That's because the setup process for guest operating systems usually runs slower on a VM than it does on a similarly equipped (same RAM, disk, processor) physical machine. This also means you should shut down all other VMs when installing a new guest operating system. I use my own VPC box exclusively for testing and nothing else, and it pays to do so in terms of usability.
Apply the latest service packs.
This means service packs for both your host operating system and for VPC. When VPC was first released by Microsoft (after it acquired the product from Connectrix) there were some significant performance problems running it. Microsoft soon released an add-on called Virtual Machine Additions that solved many of these performance problems, and Service Pack 1 for Virtual PC includes an updated version of VM Additions that boosts performance even more. So make sure you've got XP SP2 installed on your host operating system and VPC SP1 installed on Virtual PC. And if you've got RTM VPC running on XP SP2, you really need to install VPC SP1 as performance is bad without it.
Note that if you previously installed VM Additions on guest operating systems before you applied VPC SP1, you need to be sure to update the VM Additions on your VMs to realise the gains available. To check whether a particular guest operating system has VM Additions installed on it, start the VM and open Control Panel from within the VM. Then open Add or Remove Programs and Virtual Machine Additions should be displayed under Change or Remove Programs. To install or upgrade VM Additions on a VM created under VPC RTM, start the VM and select Action | Install or Update Virtual Machine Additions, then click Continue and follow the prompts.
Regularly defragment your hard drive volumes.
You should defragment both the physical drive your host operating system is located on and the virtual drives within the VM for each guest operating system running on your machine. I also defragment the physical volume where I store my VHDs as I've found that if this volume becomes fragmented it takes longer for VMs to start up and they probably run more slowly. If you're short on disk space on the drive where your VHDs are stored, you can compress this drive to gain more room. From newsgroup discussions it appears that storing VHDs on a compressed drive usually doesn't have a negative effect on VPC performance, so NTFS compression of the volume you store your VHDs on is another option to consider if needed.
Allocate VPC resources appropriately by configuring Virtual PC performance options.
By selecting File | Options you can open the Virtual PC Options screen and configure VPC performance options. You can use these options to allocate CPU resources appropriately when you have multiple VMs running on your machine, and also to specify whether the VM that has foreground focus is given preference to CPU cycles or whether VMs in the background should be able to use the processor to the degree they need it. For example, if you're running guest operating systems that are mostly Windows servers you probably want to give them equal CPU time and let them run at max speed in the background so domain controller replication and other server-related activities can function well.
Another configuration issue is how much RAM is used by each VM running on your host operating system and how much RAM is left over for the host operating system itself to use. Microsoft recommends that you don't use more than half your RAM for all your running VMs so your host operating system will still have plenty of RAM itself. That may be excessive on a machine that has 2GB or more RAM as it's hard to see why XP needs a whole gig of RAM just to run VPC when you have two VMs running that each use 512MB.
Still, watch how much RAM is available for your host operating system when you're running multiple VMs in a virtual test network scenario, and if performance seems sluggish try lowering the RAM assignment for one or more of your VMs a bit and see what happens. Don't set the RAM for your VMs too low however, for if your guest operating systems don't have enough RAM to run well then paging activity will increase, and that means increased read/write activity to the hard drive where your VHDs are stored. VMs need RAM enough and to spare, otherwise, hard drive performance will quickly become the bottleneck in your VM performance.
Consider using fixed-size VHDs instead of dynamic ones.
The default VHD created by VPC is a dynamic virtual disk that can expand in size when it needs more space, for example when you install additional applications on your guest OS. Microsoft suggests that using fixed-size VHDs can realise significant performance gains over dynamic ones, but the downside of this is that if you create a fixed VHD that's too small you can't resize it later on.
Microsoft Virtual PC 2004 is a terrific tool for test purposes and I plan to cover that topic in more detail in my next article on WindowsNetworking.com. But to get the most out of using VPC, you need to install it on appropriate hardware and properly configure and maintain both your host operating system and your VMs.
I'll leave you with a few final tips I found on the blog of Ben Armstrong, a Program Manager on the Virtual Machine Team at Microsoft:
If you run Virtual PC and Virtual Server on the same machine simultaneously, VPC can benefit from some VM enhancements realised when VS2005 SP1 Beta is installed because of updates to shared components between these platforms. Why would you install a beta SP on your VPC box? Well, you're likely using it for test purposes anyway, aren't you?
If you remotely connect to your VPC test box from another machine using Remote Desktop Connection, you can improve the performance of VPC over RDC using some tweaks Ben describes.
If you plan on running old MS-DOS apps on a VPC box (to keep those legacy apps running for your business!) then here are some tips on making this work well.
Find your next job with techworld jobs