Friday 15 August 2014

Tips and tricks to improve your VmWare VM performance

Problem:
I run various virtual machines on VmWare Player (6.0.3) running on K/Ubuntu 14.04 on a Core i7 laptop.  I get terrible performance on all virtual machines I run regardless of the guest operating system I run (Win7-64, WinVista, WinXP, Linux).  Issues:
  • Slow to start from suspension
  • Freezes occasionally for up to 30 seconds.
  • Seems to thrash the hard drive when running
  • Slow to suspend 
Laptop has more than 8GB of RAM and two hard disks, both running at 5400RPM.  Performance does not improve regardless of the RAM I allocate to the VMs (e.g.: 1-4GB).

Solution:
After various failed attempts I found the following combination of optimisations to worked best with the setup I have:
  • Move VM: Move the VM to another hard drive away from the hard drive that runs the Host system.  Preferably move it to a higher performing HDD (i.e.: 7200RPM or 10000RPM).  What seems to happen is that during certain times, the Host system tries to access the HDD (presumably to access VMware libraries) as the same time as the Guest OS.  This results in HDD trashing and very poor performance.  Sometimes even the Host seems  freeze when this happens.  By moving the VM to a seperate hard drive we remove this bottleneck.  Even USB HDDs seems to perform better when the Guest was moved to it rather than having the Host and the Guest on the same 5400RPM HDD.
  • Use the amount of RAM recommended by VMware:  Using more than the recommended amount of RAM on the VM seems to have no improvement on the system performance of the Guest.  I have read some posts which say that the Guest performance can even be decreased by having more RAM on the VM.  I personally have not seen this effect.
  • Turn 3D acceleration off:  Enabling 3D acceleration seems to thrash the HDD more frequently and did not visually provide any improvements. Turn it off if you are not using 3D acceleration.
  • De-fragmenting the VM hard drives: Marginally improved performance was noticed when using de-fragmented VM hard drives.
  • Do not allocate more than 2 virtual cores (vCores) to the Guest VM.  Adding more cores may actually slow the Guest and Host PCs down if the specific application you are running is not designed to take advantage of SMP. See IssueWithMultipleCores.  

Trials that failed:
  •  Running"Bumble bee" graphics acceleration on the Host and enable the VM 3D acceleration.  Actual performance seems to degrade slightly with this setup.
  • Hacking the VMX files to optimise different option.  There was slight improvement of the performance of the VMs but it was not significant.
Other interesting behavior:
  • Recently discovered that having a Bridged mode network connection occasionally degrades the VM performance for about 5 seconds. The reason is currently unknown (Possibly NetBios announcements causes some extra processing). Things seems to get better longer you keep the VM Open.
  • I have noticed that when the VM is first starts up, from cold boot or from a suspended session, everything seem to be slow for about a minute.  Even mouse moves and clicks seems slow.  Then it gets better and stays better.  My hypothesis is that:
    • Host machine loading the guest RAM in to real RAM (from paged memory) takes time
    • There is some sort of caching that helps performance.
 Conclusion:
If you want to substantially improve the performance of your guest VMs, following will give you a good head start:
  • Move the VM to another HDD (Preferably to a higher performing HDD)
  • Set the guest RAM to VmWare recommendation.
  • Turn 3D acceleration off if you are not using it
  • De-fragment your virtual disks from within the VM as well as from the VmWare Player tools

1 comment: