How can I optimize the performance of my Virtual Machine environment?

This article's recommendations are intended as suggestions for lab testing or proof of concept builds. Some of these settings will apply to both physical and virtual servers. Because resources are generally more limited in labs, some suggestions will differ from best practices in a production virtual environment.

Following are suggestions for optimizing a virtual machine environment for speed:

  1. If using IDE or SATA disk drives on the host in a test environment, consider enabling 'Advanced Performance' for the disk drive(s). In the Device Manager tree on the host, expand Disk Drives. Double-click the disk drive hosting the virtual machines and go to the Policies tab to find this setting. Enabling Advanced Performance may not be advisable in certain production environments due to the added risk.1
  2. Review the following before selecting the type of disk controller to be used for the guest:
    1. For best disk drive performance, attach your virtualized disk drive using the VMware LSI Logic SCSI controller.
    2. If using VMware Workstation 6.0 or lower, with SQL Server on-box inside the VM, attach your virtualized disk drive using the VMware IDE controller.2
    3. If available physical memory is adequate for all running VMs, you can reduce a VM's I/O by going to the VM menu, Settings, Options tab, Advanced page and selecting 'disable memory page trimming'.
  3. Virtual disk allocation:
    1. Preallocate the full capacity to the virtual disk during creation when storage space is available to avoid extra I/O overhead associated with growable disks.
  4. Allocate adequate RAM to the guest OS:
    1. With SQL Server on-box, running NS 6.x, 1GB or more
    2. With SQL Server on-box, running NS 7.x, 2GB or more
  5. Allocate Virtual CPUs:
    1. With NS 6.x, 1 vCPU is generally sufficient
    2. With NS 7.x, 2 vCPUs are recommended
  6. Install the current virtual machine tools (accelerated drivers) into the guest OS.
  7. If building a dedicated SQL Server VM, see SQL Server 2005 and 2008 implementation best practices and performance tuning
  8. If SQL Server is installed inside the guest, optimize Windows' memory allocation settings:
    1. Under Computer Properties, Advanced tab, Performance section, click the Settings button, Advanced tab. In the Memory usage section, click the Adjust for best performance of: Programs radio button.
    2. Under Control Panel, Network Connections, open the active network connections properties, go to the File and Printer sharing for Microsoft Networks properties and click the 'Minimize memory used' radio button
  9. Defragment the virtual machine host and guest drives as needed. Following is the optimal order to defragment:3

    Important

    Do not defragment inside the guest if any snapshots exist or performance will be degraded. Defragment before taking a snapshot.

     

    1. Defragment the disk inside the guest OS and shut down the guest.
    2. For VMWare, run a defrag using the VM menu, Settings, double-click the disk to defrag and click the Defragment button.
    3. Defragment the host drives.

References

  1. SQL storeng errors or SQL tempdb 'bad page id' errors logged while installing Solutions - Symantec KB Article TECH33607
  2. Defragmenting Virtual Disks - http://www.vmware.com/support/ws55/doc/ws_disk_defrag.html