This posting is one in a long series of blogpostings in which I compare various features of VMware vSphere 5.1 with Windows Server 2012 Hyper-V.
This posting will compare the affinity and anti-affinity rules available in both products. Actually, those rules to keep VMs together or separate on hosts is run by VMware vCenter Server and Microsoft System Center Virtual Machine Manager 2012 SP1. SP1 is expected to be released begin 2013.
Other postings in this serie are:
Microsoft Windows Server 2012 Hyper-V compared to VMware vSphere 5.1
vSphere 5 versus Windows Server 2012 Hyper-V: storage integration
vSphere 5 versus Windows Server 2012 Hyper-V:management
vSphere 5 versus Windows Server 2012 Hyper-V: high available VMs
vSphere 5 versus Windows Server 2012 Hyper-V: Resource metering for chargeback
vSphere 5 versus Windows Server 2012 Hyper-V: costs
vSphere 5 versus Windows Server 2012 Hyper-V: hybride cloud
VMware vSphere 5.1 versus Windows Server 2012 Hyper-V: replication
In a dynamic environment like server virtualization and cloud IT-management need some control over the placement of virtual machines and virtual machine diskfiles on hosts and datastores.
What is virtual machine anti-affinity and affinity and why do we need it?
Critical applications or services are often made high available by having multiple instances of databases or applications (distributed applications) . Think about Active Directory Services domain controllers, Exchange Database Availability Groups, web servers part of a tiered aplication etc. If those applications/services are running on multiple virtual machines, we do not want to have a redundant set of VMs running on the same host. If the host fails, the service will fail as well.
VMware vSphere DRS and Microsoft SCVMM Dynamic Optimization will loadbalance VMs over available resources. To prevent certain VMs to run on the same host we use anti-affinity rules.
We also can have a demand to keep a set of VMs running on the same host. Most likely because those VMs have a dependancy. To deliver the best network performance we prefer to keep the VMs on the same host. This can be controled using affinity rules.
Anti-affinity and affinity rules in vSphere 5.1
Setting affinity and anti-affinity rules in vSphere is very simple. In the properties of DRS on a cluster VMs rules can easily be made using the vSphere Client or Webclient.
The cluster will make sure VMs are not running on the same host. The rule will be immediately effective. So the rule is applied when a host fails but also during normal operations.
Several rules are available in vSphere :
VM-VM affinity rules: keep VMs to together running on the same host.
VM-VM anti-affinity rules: prevent VMs running on the same host.
Host-VM affinity: VMs must run on a certain set of hosts or VMs should be running on a certain set of hosts. More info here
vSphere 5.x has a feature called Storage DRS. This is DRS for virtual disks; vSphere tries to loadbalance disk over datastores. Here we have Storage DRS affinity and anti-affinity rules. These roles keep virtual disks of the same VM on the same datastore or make sure disks are always located on different datastores.
Anti-affinity and affinity rules in Windows Server 2012 Hyper-V + SCVMM 2o12 SP1
Service Pack 1 of SCVMM 2o12 offers a new feature named availability set. At the properties of the VM the VM can be added as a member of an availability set. When you place virtual machines in an availability set, SCVMM will attempt to keep those virtual machines on separate hosts for improved continuity of service. That is, whenever possible, VMM will avoid placing those virtual machines together on one host.
Placement fof VMs on hosts can be controlled using the preferred and possible owners properties of virtual machines. This could be useful for example for licensing reason. Oracle is notorious for its policy (which does not have any legal ground) to let customers pay licenses for all nodes in a cluster. You can show the Oracle LMS guys that your VMs cannot run on more than a few hosts in your cluster.
- If you want to control which nodes (servers) in the cluster will own the virtual machine most of the time, configure the preferred owners list.
- If you need to prevent a virtual machine from being owned by a particular node, configure the possible owners list, omitting only the nodes that should never own the virtual machine.
I have not found a feature to keep VMs running on the same host (affinity rule)