Running SQL Server in a VM

Are you trying to use virtual machine (VM) technology for production tasks such as SQL Server system consolidation? Are you testing the SQL Server 2005 beta? Are you using a VM to run database demonstrations on your laptop? If you answered yes to any of these questions, you're concerned about performance. Here are five tips to maximize SQL Server performance in a VM. These tips apply to SQL Server running under Microsoft Virtual PC 2004, Microsoft Virtual Server 2005, and VMware's Workstation and GSX Server.

5. Preallocate the Virtual Hard Disk Storage

VM products use virtual hard drives that can dynamically expand as your storage needs increase. By preallocating storage, you can avoid performance degradation when the dynamic hard disk expands. Also, using a raw or linked hard drive can provide better SQL Server performance.

4. Use a Separate Spindle for the Virtual Hard Disk

The VM has a guest OS that performs memory management, I/O, and paging. Creating the VM's virtual hard drive on a different physical drive than the host's OS reduces drive-spindle contention and improves the VM's performance.

3. Defragment the Host and Virtual Hard Drives

You can defragment a VM's virtual hard drives because the host OS sees them as standard disk files. Defragmenting the host's hard drive ensures that the virtual hard disk is stored continuously on the drive, which improves performance. However, defragmenting the host's physical hard drive won't affect fragmentation levels in the virtual hard drive. You'll get better performance if you regularly defragment the VM's virtual hard drive from the guest OS.

2. Use a Fast Hard Drive

The VM's overall performance depends on the hard drives' transfer speed; the faster the drives the better the performance. If you're running SQL Server on a laptop, use at least 5400 rpm drives. If you're running on a server, use 10,000 rpm drives. Faster is always better.

1. Use Enough RAM

A VM can use only physical memory—not virtual (or paged) memory—on the host. So you need enough physical RAM on the system. Approximately 1GB of physical RAM is enough for four VMs if you're running only the OS. If you're running SQL Server in the VM, 1GB is good for only one or two VMs, depending on the database requirements. All recent VM product releases support 3.6GB per VM.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.