Microsoft Virtual PC 2004 (VPC) is a software virtualization 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. Ricky Magalhaes covered installing Virtual PC in two previous articles on WindowsNetworking.com that are found here and here. My article builds on Ricky’s excellent introduction to the subject by giving you seven tips on how you can get the best performance from your VPC setup.
1. 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 2 GB RAM and hardware RAID. I initially thought of using a dual-processor machine for testing but unfortunately VPC will only use 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 recognize the SATA drive system during Setup.
2. 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 80 GB SATA drives in my test system with my XP host OS 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 multiboot my box to other platforms I’m testing and which may not work so well running under Virtual PC.
3. Use your host OS exclusively for running VPC. Any programs or services running on your host OS will drain CPU cycles away from your virtual machines, so don’t use your host OS for anything other than providing a platform for running your virtual machines on. Disable any services on your host OS like the Indexing service that can be processor-intensive in their operation. Not running anything unnecessary on your host OS is especially important when you’re installing a guest OS to create a new virtual machine. That’s because the Setup process for guest OSes 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 OS. I use my own VPC box exclusively for testing and nothing else, and it pays to do so in terms of usability.
4. Apply the latest service packs. This means service packs for both your host OS 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 OS 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 OSes before you applied VPC SP1, you need to be sure to update the VM Additions on your VMs to realize the gains available. To check whether a particular guest OS 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.
5. Regularly defragment your hard drive volumes. You should defragment both the physical drive your host OS is located on and the virtual drives within the VM for each guest OS 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 also. 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.
6. 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 (see Figure 1). 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 OSes 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.
Figure 1: Configuring Virtual PC performance options
Another configuration issue is how much RAM is used by each VM running on your host OS and how much RAM is left over for the host OS itself to use. Microsoft recommends that you don’t use more than half your RAM for all your running VMs so your host OS will still have plenty of RAM itself. That may be excessive on a machine that has 2 GB 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 512 MB. Still, watch how much RAM is available for your host OS 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 to low however, for if your guest OSes 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.
7. 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 realize significant performance gains over dynamic ones, but the downside of this is that if you create a fixed VHD that’s tool 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 OS and your VMs.
I’ll leave you with a couple of 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 realized 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.
Virtual PC is pretty cool, isn’t it?