Scott Hanselman

VM Performance Checklist - Before you Complain that your Virtual Machine is Slow

May 29, 2007 Comment on this post [22] Posted in Tools
Sponsored By

I continue to meet folks who complain that their Virtual Machine performance is slow. Yes, it would be great if VMs somehow were able to self-tune the relationship between themselves and the host OS, but that's sadly not the case.

When you're running an OS within and OS and maintaining a FileSystem within a FileSystem, not to mention sharing a hard drive spindle, there's lots of opportunities for things to go very slowly.

If you're experiencing poor VM performance, I would encourage you to go through a Performance Checklist.

Also, before you start, remember what you goals are. You'll not get your VMs running at 100% of native speed, at least not this year, so just stop aiming for that as a goal.

Here's some more realistic goals:

  • Ideally Virtual PC performance is at:
    • CPU: 96-97% of host
    • Network: 70-90% of host
    • Disk: 40-70% of host

Try to make all of these changes if you can. If you can't do one or more of these recommendations, then you can't complain. ;)

Virtual PC Performance Checklist

  • Make sure your Host Operating System's disk is defragmented.
    • This includes the System Disk (the disk your OS boots off of) as well as the Disk that holds your Virtual Hard Disk File.
      • For a quick fix, use a single-file defragmenter like Contig from SysInternals. With the Virtual Machine shut down, run Contig -a to analyze single file fragmentation and run without -a to defragment the file.
  • Run Fewer Applications.
    • I'm continually amazed when folks complain about VM performance and when I get to their desk I see that they are running Outlook. That 200+megs could be better used by the system. Are you running a VM or checking your email? Consider checking your email on a schedule, or using Outlook Web Access while you work on your VM.
    • If you have 2 GIG or more of memory, consider running your Host Operating System without a Paging File. This doesn't mean you get to keep 50 applications, plus Outlook running all at once, but it does take the pressure off your Host OS's disk, and you might find things run considerably snappier.
  • Run the Virtual Machine on a separate spindle.
    • There's no better tip, as anyone who has run VMs (I've been using VMWare since it was in Beta) will tell you. The #1 bottleneck is disk.
      • Try to use a 7200RPM or 10000RPM drive for your VM disk
      • Use USB2 or SATA or Fireware.
        • If you're using USB2, make sure the Eternal Hard Drive is on it's own USB root hub, all alone. Don't share it with your keyboard, mouse, or webcam.
  • Optimize your VM for your current task.
    • Personally, I use and highly recommend Invirtus Virtual Machine Optimizer for this. It's inexpensive if you value your time. Considering getting a site license and actually do the math at how much time it'll save your company when you're trying to convince your boss. I run it over lunch on a VM and move on. You can also do a lot of the work manually if you have the time using tools like XPLite and CrapCleaner (although less so with CrapCleaner if the box is already fresh).
      • Remove any application that's not needed.
      • Shut down every service you can possibly get away with.
  • Enable Hardware Assisted Virtualization
    • If you've got this on your computer, turn it on. There IS some concern about really sophisticated Trojans that can use this technology for evil, but for me, it's all good as it speeds most Guest Operating Systems (especially non-Microsoft ones) up quite a bit.
  • Give your Virtual Machines LESS MEMORY
    • I've found that 512 megs is just about the Ideal Amount of memory for 90% of your Virtual Machines. Don't bother trying to give them 1024 megs, it's just not worth the pressure it'll put on the Host Operating System.
  • Considering making a custom Windows install for your VMs.
    • Rather than going to all the effort to REMOVE things, why not create a Windows installation that can be shared across your organization that doesn't include the crap ahead of time. There's a Windows Installation Customizer called nLite that lets you prepare Windows installations so they never include the stuff you don't want. Makes it easier if Solitaire is never installed, eh?
  • Make sure the Guest Operating System is defragmented.
    • Jeff likes this free Disk Defragmenter that runs in that "Text Mode" place before Windows really starts up. This allows it to get at files that don't always get defragmented.
  • Squish your VM Hard Drive.
    • Again, I use Invirtus so it does this for me, but you can also zero out the free space on your VM hard drive with the Virtual PC Pre-Compactor that comes with Virtual PC when hosting Windows, and there are Linux options for shrinking VM hard drives as well.
  • Don't use NTFS Compression on the Virtual Machine Hard Drive File in the Host Operating System
  • Don't Remote Desktop or VNC into Host Operating Systems that are hosting Virtual Machines.
    • If you're remoting into a machine where THAT machine is running a VM, note that to the Remote Desktop protocol (and VNC) the VM just looks like a big square bitmap that is constantly changing. That guarantees you slow performance. If you can, instead, Remote Desktop into the Virtual Machine itself.
  • Make sure you've install the Virtual Machine Additions (or Tools, or Utilities, or Whatever)
    • Virtual PC and VMWare and Parallels all include drivers and tools that improve the performance of your Virtual Machine. They are there for good reason, make sure you've installed them.
      • Also, if you're running a Virtual Machine created under and older version, like Virtual PC 2004, and you're now running under a newer one, like 2007, pay attention to the upgrade warnings and install the latest drivers and Virtual Machine Additions.
  • Optimize Painting and the "Perception of Responsiveness"
    • If you're running a VM, you don't need to have eye candy like menu fades, smooth scrolling or shadows.
      • Turn off wallpaper
      • Turn off Window Dragging and Shadows under Menus (under Effects in the Display Control Panel). Consider removing all effects like fading as well as ClearType.
      • Consider running the Classic Theme if you're running an XP VM, or consider "net stop themes" altogether.
      • Turn off the Mouse Pointer Shadow in the Mouse Control Panel.
      • Turn off Mouse
      • Use TweakXP or change the Registry to remove the Menu Delay for the Start Menu and other Menus via the MenuShowDelay setting in HKEY_CURRENT_USER\Control Panel\Desktop.

Did I miss any tips?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
May 29, 2007 23:45
You missed this one:

* Run Windows Server 2003 rather than Windows XP if at all possible in the VM. Server 2003 is a lot more lightweight than XP.
May 30, 2007 0:00
One more thing, I use Parallels on OS X, and Paul Thurrott recently wrote up this article on PC and Macs saying that Parallels on OS X performs better than any virtulization program he has used on a PC:

It's under the Using Parallels Desktop section. Parallels is an impressive piece of work, and they have a version for Windows, I wonder if it performs as well on Windows as it does on OS X. One more thing, Parallels Desktop for Mac OS X comes with Compressor and Transporter for free, which I think does all that the Invirtus product you have been talking about does. I wrote about migrating a Virtual PC image into Parallels using Transporter on my blog, it's pretty easy:
May 30, 2007 0:02
Weird, my first comment is "under review" for potentially violating site guidelines. I won't repost as instructed, but my "One more thing" opening on the above comment doesn't make sense without it...
May 30, 2007 0:45
Running on an external Firewire 800 drive works great for me. And once I turned hardware assisted virtualization on my Vista environment worked great. I do still give is a full gig of my 2 available gigs because I do all of my work with Visual Studio and Management Studio in the virtual instance. My one issue lately is not knowing how to get the latest virtual machine additions for VPC 2007. I have a version installed but I expect they should have a more recent release available for download.

Any ideas on that?
May 30, 2007 0:47
I'm continually amazed when folks complain about VM performance and when I get to their desk I see that they are running Outlook. That 200+megs could be better used by the system.

Holy cats! 200+ MB for just Outlook? What are you doing with it? I'm in a typical corporate environment where I can easily get over 100 emails inn 8-hour work day. Not to mention filtering rules, event notifications, etc. Outlook is idling at 32MB right now, and I can't figure out a way to get that to rise appreciably other than searching my mail archives.

May 30, 2007 0:58

The problem isn't NTFS compression for 4+ gig files, its using "Compressed Folders", the poor-man's WinZip. I've never really found a major performance decrease when using NTFS compressed .vhd files. The compressed .vhd files really helps out with differencing disks. I've worked with three and four layers of differencing disks all sitting on NTFS compressed volumes without noticing any perf. issues.
May 30, 2007 1:14
Brennan - Those tools are usually in an ISO image installed in the Program Files folder of Virtual PC. Just capture it to a CD and run the setup.exe inside.
May 30, 2007 1:32
From personal experience with VM (running in MS Virtual Server) - i have grave doubts about your claim of VM CPU performance approaching anywhere near 90% of native.

Can you put more substance behind that claim and post a CPU benchmark of your native server vs. vm running on that server? For example i used a popular prime number benchmark (can't remember the name, wprime maybe? not sure.) and my numbers were more like 70% of native.
May 30, 2007 1:38
Vincent - I'm not sure if wprime would be a good benchmark, but I have no reason other than gut to explain it. However, your point(s) are well taken. I'll take a moment (with hardware assisted virtualization on) to test that assertion again. Thanks for calling it out!
May 30, 2007 1:44
We use VPC for testing our applications before they go to production. For this reason we like to have the virtualized Windows instance as close to a production install as possible and the idea of using xpLite or similar tools and shutting down services doesn't really suit.

I'm also running the Orcas Visual Studio + TFS Beta VPC from Microsoft so allocating anything less than 1gb to the VPC isn't feasible. I've since upgraded my host PC (Vista x64) to 4gb of ram to cope though.

But then again, I don't complain about my VPC performance.
May 30, 2007 3:20
Have your virus scanner exclude .vhd files in the virtual machine folder on your host.
May 30, 2007 3:28
These are great tips!

Also, if you are running an Anti-Virus software on your host machine, make sure you aren't doing a real-time virus scan on your virtualization files. Exclude the normal virtual machine hard disk files (vhds, undo, saved state, etc), config files, and any other files associated with the virtual machines.

If running all virtual machines in undoable mode, keep the parent virtual hard disk files on one physical drive and the undo disks on a different drive to separate the reads from the writes more.

Use virtual SCSI over IDE when possible when creating your virtual hard disk files.

And I don't want to sound like a commercial, but if you are talking about Virtual PC/Server or VMware Workstation/Server on Windows, my company has a product that helps with the disk I/O bottleneck and subsequent slowdown in virtual machine performance. You can use InovaWave's DXtreme product to speed up disk I/O and give your virtual machines a well deserved performance boost.

Good luck, keep the list growing.
May 30, 2007 3:38
Craig - Excellent tip! Of course, turning it off completely is nice too. :)
May 30, 2007 10:00
Since I got a dual core processor, the most obvious benefit is a single-threaded app stuck at 100% CPU utilization no long brings my system to its knees.
May 30, 2007 13:22
Try also the new VMWare Workstation 6.

It now does also support USB2.0 and multiple monitors. I also like the networking in VMWare and the new possibility to debug directly from Visual Studio in virtual machine.

The only minus is the price ...
May 30, 2007 13:34

From personal experience with VM (running in MS Virtual Server) - i have grave doubts about your claim of VM CPU performance approaching anywhere near 90% of native.

There's your problem. MS' virtualisation products are a long way behind, for example, VMware's. We observed a substantial improvement in system performance at our company after replacing Virtual Server with VMware Server.
May 30, 2007 14:02

Great List!
On VMs running servers I like to
- Restrict CPU for the VMs, in case of racing VM.
- Put swap and temp on a seperate drive
- Put %ProgramFiles% on a seperate drive
- Put SQL stuff on one or more seperate drives (consider tempdb, dbs, logs and backups)
- Preallocate swap file size you expect to see
- Autologon, manually start services with a .cmd file on the startup menu
- Autostart the servers with some time between them so that each VM gets a little time-window on host startup
- Turn off automatic installation of updates
- Avoid system restore
- Go even longer on the RAM restrictions, VSTS server for instance runs just fine on 400MB RAM if you manually start the services on autologon, SQL (all)
- Avoid using diff disks
- Avoid using SW RAID in 2003 (excessive IO)

May 30, 2007 14:07
Forgot one: Run Windows Server/64 on the host if possible, I think IO is just better.
May 30, 2007 14:35
PeteL has a few more tips on things to remove before you compact your image here some of which I don't believe CCleaner will touch.

If you use many different VPCs as well, you might like to try out using differencing (and undo) drives too which keeps the bloat down. In which case, Andrew Connell has two good articles here and here with more speed tips and how to set it all up.

Finally, if you use sysprep at all to put your VM images in carbon freeze, you should be aware of the disappearing MAC address problem. It's not a performance tip as such but will cut you off the network if you encounter it.
May 30, 2007 19:57
I agree about the paging file. Right now i have 4 gb of DDR2 800 memory, and have a 1.5 GB paging file on my iRam (for Vanguard: Saga Of Heroes which seems to like to eat up all my memory.)

Also, Windows Vista LOVES memory. I dropped in another 2 GB and now i cruise away (not that i was sluggish in Vista with 2gb, just with vanguard).
June 06, 2007 9:53
Small typo "Eternal Hard Drive" should be "External Hard Drive". Great tips.
June 12, 2007 14:52
Can anybody confirm whether or not there is a performance gain from using fixed-size virtual hard disks? My gut feeling is that fixed-size vhd files are less likely to be fragmented on the host hard disk. Ovisously, they're more awkward to administer but that's a secondary concern for me.


Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.