views:

1199

answers:

9

As a best practice I use a virtual machine for my development - I would like to try and optimize my VM as much as possible. All I have installed is server 2003, IIS and Visual Studio 2008. What do you do to optimize your development VM i.e what service do you switch off etc...

+7  A: 

I always disable "System Restore" on my Windows XP virtual PCs.

M4N
+8  A: 

I switch off the file system indexer, saving disk space and CPU time.

Davide Vosti
I do this on every PC I install. System Indexer is the biggest waste of time ever.
Umber Ferrule
+2  A: 

There is a great article about Virtual Machine performance here

It's written specifically about Sharepoint virtual machines, but there are plenty of tips that apply in general.

Paul Nearney
+5  A: 

Putting the disk images on external HDD (even usb) can improve performance (with a laptop specifically)

Dog Ears
HDD speed for one. Most laptop HDDs spin at 5400 RPM while most external HDDs spin at 7200 RPM. That is if the link doesn't slow you down. If you only have USB 1 it will not be any faster, but USB 2, 3, or FireWire might be faster.
NitroxDM
even with similar speed disks (both internal and external drives on my laptop are 7.2K) the distrubtion of load improves overall performance, i run all code and DB's from an external HDD and the build times are quicker than when on the internal drive! [that's with USB2, eSata would be even better!)
Dog Ears
+6  A: 

Ixclude my build folder from my virus guard for on access scans

These are the services that I turn off in my VM

  • Turned off Shutdown event tracker
  • Switched off indexing on c:\
  • Error Reporting Service switched off
  • Smart Card Access switched off
  • TCP/IP NetBIOS Helper
  • Remote Desktop Help Session Manager
  • Remote Registry
  • Uninterruptible Power Supply
  • Windows Audio
  • Wireless Zero Configuration
Nicholas
+1  A: 

I disable the Windows page file when using VMware Server. Disk IO is the weakest link with VMWare Server, and nothing is worse than paging virtualized RAM to a virtualized disk file. Give your VM enough RAM and this works pretty well.

Also, not all virtualization solutions perform the same in different areas. VMware is great for stability and mobility of VM images, but you might want to try some other solutions if you have the time. I've found that better disk IO performance gives me a better overall experience, so I traded the better CPU performance (and overall stability, unfortunately) of VMware server for the better IO performance of VirtualBox. The non-free VMware versions may be much better, but I have no idea.

I've found that putting the disk images on a separate drive doesn't buy you that much. Plenty of people will argue this, and it can give you a little bit more performance depending on how much else is going on with the host, but for me it was marginal. I tried using a raw disk also, which didn't do as much as I'd hoped.

One thing that does really kill IO performance is running with a snapshot active. This uses a copy-on-write strategy on most implementations, and you can expect 20% drop in disk performance.

dnewcome
A: 

I recently built a VM and I started to optimize it before I even did the install by using Nlite and Windows Update Downloader. NLite allows you to strip out all the components you don't need (mspaint,pinball,french, etc.), apply all your windows updates, and tweak out registry and service settings. So you can have the System Indexer disabled on first boot for example. If your using Vista or 2008 Vlite is available as well.

Ryu
+10  A: 

As always, there is no single set of recommendations that are universally "correct" or "best". However, these are some of the items that have worked well for my development virtual environments.

Hardware Tips


Plenty of memory!

Determine how much memory each one of your virtual machines require and how much memory your host requires (if you are running things in the host at the same time). Add up the total of memory requirements for all VMs that will be running simultaneously and determine the maximum VM RAM load and add in the host load. I suggest having at least 512MB of "padding"

For example, I need about 768MB for the host OS (WinXP Pro SP3) and about 1GB in my guest OS (WinXP Pro SP3 w/ Visual Studio 2005/2008 and SQL Server Developers Edition). 1024MB + 768MB + 512MB = 2.3GB

Personally, since RAM is incredibly cheap currently, I just maxed out my 32-bit system with 4GB (3.5 addressable).

Separate Spindle for your OS and VMs

Have a disk separate from your OS disk to run your virtual machine images. This greatly reduces the disk I/O contention between the Host and the Guests.

NOTE: Using an external HDD to get the spindle separate can help, but beware - Firewire and USB have higher latency than IDE, SATA, or SCSI! While the USB 2.0 and Firewire interfaces have more than sufficient bandwidth for maximum disk throughput they do add a significant amount of latency to each operation. This becomes very significant in high disk transaction, small file accesses situations like C++ compilation. I haven't had a chance to run some tests on eSATA yet to see how well it performs in comparision to internal SATA access times.

Use Disks with Low Access Times

During development there is quite a bit of random disk access occuring, especially during compilation in languages like C++. Using a 7200 RPM over a 5400RPM drive for your VMs reduces access times and thus, reduces compile times. Going to a 10,000RPM or high-end SSD reduces these times further. The point of diminishing returns depends on the particular disk access load/patterns of your environment.

Host Tips


Disable Virtual Machine File Virus Scanning

Tell your virus scanner to ignore your Virtual Machine directory OR the .vmdk file extension so that it won't be constantly scanning your virtual machine disks.

Avoid CPU contention

If you are running more than one virtual machine at a time OR you are doing work both in the host and the guest OS, then save at least 1 CPU for the host OS on a multi-core/proc machine. For example, if you are running two virtual machines and doing no work in the host OS then a dual core processor on the host with single core virtual machines will probably serve you best.

If you are running a single virtual machine and no work on the host OS, then running a dual processor VM may be helpful if the virtual machine applications can make use of the second processor.

If you are running two virtual machines, 1 which is single proc and 1 which is dual proc, you probably need to be running a quad-core system.

VMware Note (not confirmed for other virtualization applications): If you give a virtual machine multiple processors, it will wait for both processors to become available and will reserve them even if it isn't using them. This can cause significant contention between virtual machines or between the virtual machine and the host.

Guest Tips


Allocate sufficient memory

Make sure you allocate enough RAM to cover the virtual machine's demand

Avoid using snapshots

Don't use snapshots unless you really need to. There is a significant disk I/O penalty associated with maintaining a snapshot based virtual machine file system.

Don't run unnecessary services

Such as:

  • Indexing
  • System Restore
  • Error Reporting
  • Wireless Zero Configuration

Don't run security software

Consider not running anti-virus, anti-spyware, or firewall software within your VM. You'll have to weigh the pros/cons of security vs speed here. For many, if they get a virus it's not a problem, they just restore a previous copy or snapshot. For others, the potential exposure of sensitive information requires strict security policies even within the VM.

I will say that not running anti-virus or firewall software within the VM is probably the number one reason that VMs of Windows often feel "snappier" than their physical host OS counterparts.

Defragment!

Unfortunately, there are three places file fragmentation can occur in a VM configuration: Within the Guest OS's filesystem, within the virtual machine file's (e.g. vmdk) representation of the VM, and the virtual machine file on the physical disk itself. The order in which you defragment each matters.

  • First, defragment the filesystem within the guest OS (e.g. run disk defragmenter in the guest OS or use a tool like JkDefrag or Defraggler, etc within the guest OS)
  • Second, defragment the virtual machine file (e.g. VMDK) using tools such as vmware-diskmanager
  • Third, defragment the file system on the host which holds the virtual machine file (i.e. run disk defragmentation on the host OS)
Burly
A: 

Two SSDs, one for the host's OS and one for the VMs.

Avi