Squeeze Every Last Drop of Performance from virtual machines

Maximize your Virtual PC performance with advanced tweaks. Learn to harness every cycle from your VPCs with my comprehensive guide on optimization.

In my last article on virtualization with Microsoft’s Virtual PC 2004 SP1, I covered how you can use Differencing Disks to your advantage . However, in retrospect, this article was posted a bit out of order. The article below should have been posted first. Before you start building out your Virtual PC’s, you should first be aware of how to squeeze out every last drop of performance. After all you’re running a machine within a machine, so it’s going to be a bit slower than the host, and thus, why not make it as fast as possible!

In this article, I’ll outline some of the things I do with all my VPCs in order to keep them up to speed. Some of these things I’ve picked up along the way from my own experience, from the Virtual PC newsgroup , virtualization blogs, webcasts, and other sources. One disclaimer: I did receive a list of some performance things from someone who I wanted to give credit to, but he claimed he got the list from someone else and he wasn’t sure who that was so he didn’t want to claim credit for something that was someone else’s work. Thus, some of the techniques listed here may not be original, so please don’t take it that I’m trying to play them off as such.

Most of the items in this post will have only a tiny effect on your virtual machines. However collectively, they should help over the long haul, and surly squeeze a bit more performance out of your virtual environment… now, onto performance!

A Little Organization

First things first, let’s get organized! I love BGINFO from www.sysinternals.com . When all of my VPC’s boot up, I have them set to update the desktop so I can see the following information (you can view a sample from a VPC I recently ran up to test & get used to ISA 2004 ):

  • Machine name
  • Fully qualified sign in of current user logged in (domain\account)
  • Installed OS version & service pack level
  • Boot time & stamp when the BGINFO script was executed
  • Amount of RAM and CPU (not like CPU matters because it’s a VPC)
  • Networking info (IP, gateway, DNS, DHCP)
  • Drive size and space available

Get the code!

If you’re interested, you can download my BGINFO settings file (form below) and use this batch file to update your desktop when you sign in. Add a shortcut to the startup Start menu folder for the All Users profile and set it to run minimized. Make sure the batch file points to the correct location of your BGINFO.exe and the settings file (I stick mine in my c:\utils folder).

BGInfo Screenshot

BGInfo Screenshot

Hardware

  • The more memory you have, the better. I’ve run full blown developer VPCs with the configs above with only 768MB in the host OS. Personally, I would try to get 2GB on your host OS and dedicate at least half of that to a VPC.

  • Put all your VPC’s on a separate drive from you OS drive. This reduces contention. The best option IMHO is to get one of those self powered USB 2.5" disks like this one . Spend the extra money for the faster drive (5400 RPM), you’ll notice an improvement if you do. With that being said, I’m running a 3.5" drive that requires external power … but I primarily use it at work so portability wasn’t the biggest factor… honestly the biggest factor was the $10 instant rebate and $40 mail in rebate which made this 80GB 7200RPM drive cost less than $40. Can’t beat that!

  • Keep the drive where you store your VHD files defragmented.

  • Keep your VHD files as defragmented as possible: VHD’s are massive… the fewer fragments they are in the faster they’ll run. I use a tool called contig from SysInternals to analyze and defragment a specific file. Here’s what contig looks like:

    Defragmentation results from the Sysinternals utility 'contig'

    Defragmentation results from the Sysinternals utility 'contig'

AntiVirus

Shut off your AntiVirus software: unless you can exclude VHD and VSV files from being monitored by AntiVirus applications, shut it down… it’s just more disk contention that you have to deal with.

Kill Unnecessary Services on Startup

Every time your machine boots up, various services are started automatically. Many are important and required, but some just aren’t needed within a disposable or hosted environment such as a VPC. Some of the services I always kill are:

  • Help & Support
  • Print Spooler
  • Error Reporting Service
  • Task Scheduler (unless my VPC contains SharePoint, or another app that needs it)

An easy way to do this is to create a batch file that stops each of these services on startup. I used the same method that I used for updating my desktop with updated system info. Feel free to download and use my batch file . Just add a shortcut to the startup Start menu folder for the All Users profile and set it to run minimized… same deal as before.

Disable Visual Enhancements

Unless you’re an avid reader of the Virtual PC Guy’s WebLog and follows his Gaming under Virtual PC posts, you don’t need to have your VPC have the most optimal visual experience (than again, maybe you do… but you’re sacrificing performance for it).

Trimming the visual enhancements from your VPC is very simple. First, disable your video hardware acceleration:

  • Right-click on the desktop and select Properties

  • On the Settings tab, click the Advanced button

  • Under the Troubleshoot tab, drag the Hardware acceleration slider all the way to the left

  • Click OK out of the dialogs

    Setting hardware acceleration

    Setting hardware acceleration

Next, you need to disable the visual enhancements in the OS. These are the fading & sliding menus, smooth font edges, etc.

  • Right-click My Computer and select Properties

  • Under the Advanced tab, click the Settings button under the Performance section

  • Under the Visual Effects tab, select the radio box for Adjust for best performance

  • Click OK out of the dialogs

    Performace Options - Visual Effects

    Performace Options - Visual Effects

Disable System Protection/Safeguards

If you’re running WindowsXP as the guest OS (the OS within your VPC), you should disable the system restore process that helps you rollback changes to your environment. It’s an unnecessary monitoring service, one you can duplicate using VirtualPC’s undo disks.

  • Right-click My Computer and select Properties

  • Under the System Restore tab, check the checkbox for Turn off System Restore on all drives

  • Click OK out of the dialogs

    System Properties - System Restore

    System Properties - System Restore

Another setting enabled on a default install is the OS will create a memory dump file on a system failure. While this information is helpful if you’re on a PSS call troubleshooting a BSOD or if you’re handy with WinDbg and understand the intricacies of debugging, I don’t deem it necessary… and it’s quite easy to disable:

  • Right-click My Computer and select Properties

  • Under the Advanced tab, click the Settings button under the Startup and Recovery section

  • Under the System failure section, select (none) in the Write debugging information subsection

  • Click OK out of the dialogs

    System Properties - Startup and Recovery

    System Properties - Startup and Recovery

Disable System User Friendly Settings & Accessibility

Finally, there’s one last setting to disable. By default, Windows will search for network drives and printers. Yet again, it may be helpful in day-to-day usage, but within a VPC, I don’t deem it necessary. This setting can be found in the folder options dialog.

  • Open Windows Explorer

  • From the Tools menu, select Folder Options

  • Under the View tab, make sure Automatically search for network folders and printers is unchecked (the first option in the list)

  • Click OK out of the dialogs

    Folder Options - View

    Folder Options - View

Conclusion

As mentioned at the beginning of this article, each of these tweaks on their own won’t yield a noticeable improvement. However, collectively they should squeeze a bit more performance out of your Virtual Machines.

Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web & cloud developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to helping you be the best Microsoft 365 web & cloud developer. He lives with his wife & two kids in Florida.

Share & Comment