At work, we've been using Microsoft's VirtualPC 2007 to do CRM 4.0 development for a few months now. This entails booting what's turned into a 16 gb VHD - Windows 2003 Server R2 SP2, SQL Server 2005 SP2 (w/ patches), SRS, CRM 4.0, and dev tools - VS.NET 2005, NAnt 0.86, etc. Not only is 16 gb huge, but the 1.5gb of RAM used pushes it to monsterous levels, rendering most of our developers unable to even fire up the image unless the shut everything else off. (Note to self: Shut down Firefox with the 50 tabs, 30 of which are AJAX refeshing.)
The most common optimization tricks for Microsoft's VPC involve the following:
- Defrag your host and guest hard drives
- Place the client vhd on a seperate spindle, aka hard drive.
Even a USB external for the vhd makes a massive improvement in the VPC's i/o usage and external USB drives (Maxtor, Seagate, Western Digital) are getting cheap. The ultimate, of course, would be a VHD on a USB stick.
- Get as much RAM as you can.
If you're using Vista, don't, since Vista won't allow pegging to 4 gb of RAM (in 32-bit mode) - "upgrade" to XP.
- Shut off all services you're not using on your host system
From the obvious SQL Server, IIS, to the semi-obvious, anything in your tray - IM clients, video card helpers - to the non-obvious, like iPod helpers, Picasa helpers, etc. Write a bat script to help you "net stop" and "net start" these. Every 100kb helps.
- Turn on Hardware Virtualization in your BIOS
If your PC supports hardware virtualization, turn it on
Then there's this little goodie included in VPC 2007 (since 2004, btw) that's often overlooked (from the VPC2007 release notes):
Virtual Disk Precompactor
Virtual PC 2007 includes Virtual Disk Precompactor, a utility that is designed to "zero out"—that is, overwrite with zeros—any available blank space on a virtual hard disk.
We recommend that you use Virtual Disk Precompactor before you compact a dynamically expanding virtual hard disk. Using Virtual Disk Precompactor should result in a smaller compacted virtual hard disk. After you install Virtual PC 2007, Virtual Disk Precompactor.iso is located in the folder: \Program Files\Microsoft Virtual PC\Virtual Machine Additions\.
To use Virtual Disk Precompactor, you must first capture the image file Virtual Disk Precompactor.iso. For instructions on capturing image files, see "To capture or release a CD or DVD" in the Virtual PC Help.
After you capture Virtual Disk Precompactor.iso, you can run Virtual Disk Precompactor by starting it from the CD drive of the virtual machine. To view Help for Virtual Disk Precompactor, type precompact -help. To run Virtual Disk Precompactor, type precompact.
Once you've precompacted, turn off your VPC and compact the VHD, itself.
This can be done by going to the VPC entry in the Console, pressing Settings, and using the Virtual Disk Wizard on the VHD file. There's an option to Edit an Existing VHD and Compacting it.
With all that said, I was able to get our 16gb VHD down to a svelte 13gb image. (Just in case you're keeping score here, that's not success.)
This is a post I wish I didn't have to write, because it explains how to make a perfectly fine, fast machine into something that runs slowly while also running another machine. Seems a bit silly, doesn't it?
By now, you're probably wondering why we don't use VMWare or some other solution, like, Xen? This is a good question, since VMWare's Player (not to mention images) are a few gb smaller in size when converted using VMWare Converter (takes machines and other vms and turns them into VMWare images) and also appears to have less I/O dependency (no need for a 2nd drive) and doesn't allocate RAM (no need for 3+gb for a 1.5gb image). The answer, at this time, is that we're looking into it, although I'm starting to wonder why I'm trying to optimize a machine inside a machine and when I'm going to get back to coding.
Other good tips: