Virtual Server Performance Tips

Here are some guidelines for optimizing the performance of your virtual machines from Jeff Woolsey, Lead Program Manager for virtual machine technologies here at Microsoft. Thanks Jeff!

----------------------------------

Hardware virtualization is an extremely powerful tool. When wielded properly, virtualization can result in benefits such as:

  • Higher Server Utilization: Fewer physical servers needed and running with greater efficiency.
  • Reduced physical footprint and power consumption: Fewer physical servers requires a smaller footprint and greatly reduced power consumption. 

However, virtualization is not a panacea. Before discussing specific techniques to maximize Virtual Server performance, let’s clarify some misconceptions about virtualization and performance. Virtualization is a technology that runs contrary to performance. Virtualization does not make things run faster. Say it with me.
 
Virtualization is at odds with performance.

Virtualization is the process of dividing a physical server to run more workloads and increase efficiency of the physical hardware. If you decide to consolidate the workloads of 20 physical servers onto a single physical server running virtualization, what are the affects of that process? The result of this consolidation is that 20 physical servers, which used to have their own dedicated I/O for CPU, memory, disk and network, are now running on a single server where these 20 workloads are now sharing I/O for CPU, memory, disk and network. Numerous potential bottlenecks have just been created. The good news is that modern server hardware is very fast and there are many techniques to help mitigate these bottlenecks. But, the key to a successful virtualization experience is to understand and alleviate these bottlenecks.
 
With this in mind, this discussion will discuss techniques to improve performance and mitigate these bottlenecks.

  1. Install Virtual Machine Additions.
  2. Install as much memory as you can on your physical server.
  3. More host processors = more virtual machines.
  4. Use a fast disk subsystem.
  5. Put virtual hard disks on a different physical disk than the host operating system.
  6. Use virtual SCSI disks instead of virtual IDE hard disks.
  7. Use fixed-size virtual hard disks instead of dynamically expanding virtual hard disks.
  8. Install multiple host NICs.
  9. Avoid running other peer apps/services on a Virtual Server.
  10. Virtual Server SP1 Beta + Windows x64 Editions + x64 servers = Joy. 

Install Virtual Machine Additions. By far, one of the most overlooked steps in creating virtual machines is installing Virtual Machine Additions after the guest operating system has been installed. Virtual Machine Additions, included with Virtual Server, is a set of features that improve the integration of the host and guest operating systems. It also improves the performance and manageability of the guest operating system. For more information about Virtual Machine Additions, see Installing Virtual Machine Additions in the Virtual Server Administrator’s Guide.

Install as much memory as you can on your physical server. The most limiting factor to how many virtual machines can be run on a Virtual Server is the amount of physical memory in the hardware. The host operating system and each running virtual machine all require adequate memory. To calculate the total memory needed, you must allocate enough memory to each virtual machine to run its operating system (and its applications) in addition to the memory required by the host operating system. Additionally, Virtual Server can require up to an additional 32 MB of RAM per virtual machine. Here’s an example of how to calculate memory needs:

Host Operating System: Window Server 2003, Standard Edition: 512 MB

Virtual Machine 1: Guest OS Win NT 4.0 SP6 Server #1 128 MB + 32 MB

Virtual Machine 2: Guest OS Win NT 4.0 SP6 Server #2 128 MB + 32 MB

Virtual Machine 3: Guest OS Win 2000 SP4 Server #1 256 MB + 32 MB

Virtual Machine 4: Guest OS Win 2000 SP4 Server #2 256 MB + 32 MB

Virtual Machine 5: Guest OS Win 2003 Server #1 512 MB + 32 MB

Virtual Machine 6: Guest OS Win 2003 Server #2 512 MB + 32 MB

Virtual Machine 7: Guest OS Win 2003 Server #3 512 MB + 32 MB

Virtual Machine 8: Guest OS Win 2003 Server #4 512 MB + 32 MB

Total Memory Required: 3584 MB of RAM
 
As on physical hardware, allocating additional memory to a guest operating system results in improved performance.

More host processors = more virtual machines. Virtual Server is heavily threaded to allow it to scale on larger server hardware. At present, each virtual machine operates as a uni-processor; one host thread is created to act as the virtual processor. Multiple virtual machines will create multiple virtual processor threads, and those will be scheduled across the host processors.

Use a fast disk subsystem on the physical server. Like any application that is disk intensive, Virtual Server will take advantage of a fast disk subsystem on a physical server. Serial ATA (SATA) disks are faster than traditional IDE (Parallel ATA) and SCSI is typically faster than both of these. Of course, using a striped RAID configuration (more spindles = better performance) will result in even better performance as well as provide redundancy. If you’re in a SAN environment and are going to place virtual machines on a SAN, consider investing in multiple fibre channel host bus adapters. With enough virtual machines and disk activity, it is possible to saturate fibre channel. The way to determine if the fibre channel is saturated is to monitor the performance of the fibre channel card on the host Virtual Server and see if its performance is maxed.

Put virtual hard disks on a different physical disk than the host operating system.

In particular, you want to put virtual hard disks on a different physical disk than the host page file.

Use virtual SCSI disks instead of virtual IDE hard disks. Using virtual SCSI disks can provide up to ~20% performance improvement on disk activity. Remember, IDE (specifically, parallel ATA) is limited to one transaction on the bus, whereas, SCSI can handle multiple concurrent transactions. This is true on hardware as well. Use SCSI virtual hard disks when you can.

Use fixed-size virtual hard disks instead of dynamically expanding virtual hard disks. The two most common virtual hard disks are the fixed-size virtual hard disk and the dynamically expanding virtual hard disk.

When a fixed-size virtual hard disk is created, the entire space required by the virtual hard disk is reserved. So, if you create a 100 GB virtual hard disk, it will take up 100 GB of space on the physical disk. The space on a fixed-size disk is more likely to be contiguous than on a dynamically expanding disk, so fixed-size disks generally provide better performance. Also, the file size of a fixed-size virtual hard disk does not need to be expanded before data is written to the file, which also helps provide better performance.
A dynamically expanding virtual hard disk is one in which the size of the .vhd file grows as data is written to the virtual hard disk. This is the default type of virtual hard disk created by Virtual Server. When you create a dynamically expanding virtual hard disk, you specify a maximum file size. This size restricts how large the disk can become. For example, if you create a 100 GB, dynamically expanding virtual hard disk, the initial size of the .vhd file will be about 3 MB. As a virtual machine uses the virtual hard disk, the size of the .vhd file grows to accommodate the new data. Because dynamically expanding virtual hard disks grow as needed, it is less likely to be contiguous on the physical disk resulting in possibly reduced performance depending on the amount of fragmentation.
 
Install multiple host NICS. This is probably one of the easiest and most inexpensive techniques you can use to improve performance. Instead of having all of your virtual machines using a single NIC in a physical server, install multiple host NICs and assign groups of virtual machines to virtual networks with their own NICs. Now, instead of twenty virtual machines sharing a single NIC, you can have two groups of ten, or four groups of five…

Avoid running other peer applications on a Virtual Server. As a best practice and to insure best possible performance, don’t run other applications as peers to Virtual Server. If a peer application/service is running and competing with Virtual Server for resources, it’s possible that Virtual Server could be starved for resources affecting all running virtual machines. This is definitely not a good situation. While it’s understandable that there may be circumstances where it’s necessary to run peer host applications (e.g. an application that has specific hardware needs that can’t be met by running in a virtual machine), it’s best to avoid this scenario.

Virtual Server x64 SP1 Beta + Windows x64 Editions + x64 servers = Joy. If you’re purchasing a server today for Virtual Server, purchase an x64 server and run Windows Server 2003 x64 Edition. With the availability of hardware from vendors such as Intel, AMD and with the debut of Windows Server 2003 x64 Editions and Windows XP Professional x64 Edition, customers are able to reap the benefits of 64-bit computing, such as greater performance and scalability, without having to pay a premium for it. Virtual Server SP1 Beta provides native x64 host support allowing Virtual Server to run on Windows x64 Editions. Running VS SP1 Beta on Window x64 Editions allow it to be executed in 64-bit mode, which processes more data per clock cycle and allows greater access to memory.

As mentioned previously, the most limiting factor to running virtual machines is often the amount of memory present in the physical server. One of the key benefits to Windows x64 Editions lies in the 64-bit version’s ability to use much more system memory. On 32-bit Windows the limitations of 2 GB of User Mode Address Space and 2 GB of Kernel Mode Address Space With 64-bit Windows those limitations are removed allowing Virtual Server to take full advantage of large amounts of physical memory.
 
Virtual Server SP1 includes significant performance improvements. While developing Virtual Server 2005, the VM team profiled server applications and their performance characteristics. One common theme observed was how server applications tend to be modular and rely on inter-process communication. By optimizing Virtual Server for this type of workload, we have measured substantial performance improvements. In fact, some of our early adopters have reported as much as a 50% decrease in host CPU usage running the same number of virtual machines and workloads with Virtual Server SP1. Virtual Server SP1 will RTM in Q4/CY’05.