Search BrianLoesgen.com
Categories
Monday
Jun112007

Virtual machine best practices

As I was getting ready to go to TechEd last week (I presented “BizTalk’s Role in a SOI”, my new favorite presentation, plus I helped staff the Microsoft BPM stand), I went through a process I usually try to go through every few months to optimize my VM. My VMs tend to be pretty heavyweight (ie: Win2K3, SQL2005, BizTalk, SharePoint, IBM MQ and WebSphere, etc….), so optimization is important to me, as I need to squeeze out every last bit of performance.  It occurred to me that there are some virtual machine best practices that I have accumulated over the years, so I thought I’d do a blog post for the benefit of the community. This info will be self-evident to some, but to others, it will be new.


1. Which VM technology to use?
This is a technology leapfrog thing. Up until the release of Virtual PC 2007, I preferred VMWare as it was far superior to VPC. Now, with Virtual PC 2007’s improvements and support for hardware virtualization (which you may have to enable in the BIOS), the performance is close. I tend to use VMWare, as it has a great snapshot manager, plus performance is better when you have multiple virtual machines running simultaneously (as I sometimes need to do).

2. Drive speed
Remember that there will be a lot of disk IO, so the faster the drive the better. My laptop is my “office”, with all productivity tools and media on it. I have no dev tools on it. My VMs are on an external drive, I use a 7,200 RPM USB-powered drive. It gets me suspicious looks on airplanes when I stick the drive in the seat pouch and run a cable to it, but… perf is king!

3. Defrag, defrag, and then defrag
Defragmentation is something everyone should do often, as it will significantly improve performance. When VMs are being used, defragmentation need to be done on several levels. The order I do it in is:

  • Defragment the guest OS. Inside the VM, use Window’s disk defrag to defragment the virtual drive(s)
  • Defragment the VM file. The process here will vary depending on your VM technology of choice, but I believe they all do it. The VM drives exist in a file on the host, and the file can get fragmented
  • Defragment the host. Lest you forget, run Windows defrag on the host too!

4. Add-on tools
Both VMWare and VPC have optional “tools” that you install in the guest machine. It is important to do so. Installing tools will improve capabilities such as video (both performance and available resolutions) and mouse (can be “jerky” without this).

5. Snapshots (1)
I’ve noticed this with VMWare, presumably the same is true of VPC, those snapshot files can be pretty big and take some time to create. However, if you shut down the guest OS before taking a snapshot, the snapshot file will be much smaller and creation will be faster

6. Snapshots (2)
VMWare has the awesome capability of taking multiple snapshots. Be aware of how much space you’re consuming (see snapshots (1) above). The first time I noticed, my VM was up to 30 gig!

7. Multiple virtual drives
In my role as a consultant, sometimes I need to get snapshots of non-confidential client data. Sometimes these databases can be huge. In order to optimize backup and archiving of VMs, you can create a second virtual drive to host databases, and attach it to your VM.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>