Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimize development Virtual Machine

Tags:

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...

like image 668
Nicholas Avatar asked Mar 11 '09 08:03

Nicholas


People also ask

How do you optimize the performance of a virtual machine?

Provide Additional CPU If you want to speed up your virtual machine, consider increasing the amount of CPU you have allocated to the machine. Machines depend on CPU for running virtual machines and their applications. The higher your CPU availability, the better your VM performance.

What is virtual machine optimization?

Summary. The Virtual Machine Computer Optimizer (VMCO) is a Powershell script and module that uses the PowerCLI module to capture information about the Hosts and VMS running in your vSphere environment, and reports back on whether the VMs are configured optimally based on the Host CPU and memory.

Is virtual machine good for development?

Virtual machines allow a team to build, test, and deploy code within simulated environments without wasting computing resources. The benefits of virtualization include: More agility, flexibility, and scalability during development. Cost savings across the SDLC, primarily in terms of maintenance and testing.


1 Answers

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)
like image 144
Zach Burlingame Avatar answered Nov 07 '22 20:11

Zach Burlingame