Saturday, February 21, 2009

ESX Virtual Machine Best Practices


My primary focus is server-based computing, specifically Citrix Presentation/XenApp Server. With a stronger push for virtualization in most market segments, I've seen mixed results for virtualizing Citrix on VMWare.

Several vendors and consultants have recommended using XenServer (now from Citrix, formerly from Xen Source) which is better at handling XenApp workloads. My question as been, WHY? What are the key differences and why the performance difference? The key is Memory Sharing and how VMWare allows overallocation of resources.

Anyway, after a lot of reading, research, and meetings, I've put together a few best-practices. This article will focus on general VMWare ESX best practices. I'll also be posting an article specifically for optimizing Citrix on VMWare, and then more articles pertaining to rapid deployment.

With out further ado... here are my thoughts on ESX Best Practices:

USE TEMPLATES
  • Templates allow for rapid deployment of virtual machines from a stock image. The idea is to build a "GOLD" template for your basic servers, then deploy the templates and add any extra software for the specific function of that server.
  • Keep Templates small (1 vCPU, 512 RAM, 2 vHDD - seperate OS and Data drives). It is easier to grow the virtual machine after deployment.
  • At a minimum, these Templates should include each flavor of OS you need, including all the latest server packs and updates, VMTools, as well as any standard tool sets (7Zip, Notepad++, Acrobat, PSTools, Resource Kits, etc.)
  • Using Virtual Center, import SysPrep to allow customization on deployment. This allows you to package the base image, rename and IP the machines at deployment.
  • Templates should include the other best practices listed here.
  • More info on Templates is available in this whitepaper.


ALIGN DISKS

  • A common practice in high I/O systems, such as SQL and Exchange, is to align the disk partitions to the physical drives. This practice is critical for optimal VM performance.
  • Properly aligned drives increase throughput and decrease latency.
  • For Windows guest OS, use DISKPART to create a 64k Partition, which aligns with the 64k partition of the hard disk
  • Format the Windows drives using 32k allocation unit sizes
  • This optimally uses the space and prevents the data clusters from spanning multiple blocks, which then span drive chunks.
  • I recommend aligning the drives on TEMPLATES (above), so you can set it and forget it.
  • VMWare has a nice whitepaper published here, regarding partition alignment.


OTHER CONSIDERATIONS

  • For Terminal Server Apps, disable the Balloon Driver from the VMTools. This is critical for Citrix, but useful for any TS deployment to avoid Memory swaps and high CPU hits. More on this here.
  • Use separate OS and Data drives, place the PAGE File on the Data Drive
  • If possible, use Separate LUNS or Drive Arrays for the OS and Data drives
  • OS and small data drives (<200>Data stores (File shares, Exchange, SQL) and large drives should use RDM
  • Adjust the Disk timeout valie to the storage vendor's recommended: HKLM/SYSTEM/CurrentControlSet/Services/Disk/TimeoutValue = REG_DWORD Hex value 3c (60)
  • Disable Last Time Access Atrribute for NTFS, this setting that keeps track of the last time a file was accessed. Removing the necessity for the system to keep reading and writing this information may speed up performance. The command is: fsutil behavior set disablelastaccess 1


In summary, each environment is different. These are the steps I have identified for use in my environment. They may or may not be best for yours. If you apply these steps, you should see a relative performance increase in your VMs. Ideally, apply all of these to your master Templates, then deploy away.

Additional Resources:

No comments:

Post a Comment