Mike Kiev - Fotolia
The affinity and anti-affinity rules available in VMware Distributed Resource Scheduler can guide VM-host and VM-VM behaviors.
VM-host affinity and anti-affinity rules outline the affinity or anti-affinity between a VM group and a host group. For example, a VM-host affinity rule stipulates that VM members of a DRS group should or must run on members of a desired host DRS group. Conversely, VM-host anti-affinity rules prevent the VM members of a DRS group from running on members of a particular host DRS group. VM-host affinity and anti-affinity rules are cluster-based, so the VMs and hosts delineated in the rule must be in the same VM or host cluster. If a VM is removed from the cluster, it's also removed from the DRS group. If that VM is later returned to the cluster, it must be restored to the DRS group manually.
VM-VM rules outline the affinity or anti-affinity between specific VMs. For example, a VM-VM affinity rule stipulates that specific VMs should be together on the same host, often to enhance performance. An affinity rule might run a VM workload on the same host as a VM database so that the workload can access the database without having to pass data across the LAN between different hosts. Conversely, VM-VM anti-affinity rules prevent specific VMs from running on the same host, generally to enforce resilience so that a host failure doesn't disable two or more instances of the same VM, as this prevents a single point of failure in the host server.
Generally, if invoking affinity or anti-affinity rules results in a violation -- for example, two VMs are on the same host, but an anti-affinity rule is against it -- DRS will try to correct the problem, but the system will continue to run. The administrator can see any violations in the cluster's DRS tab and can produce log events for further examination. If DRS clusters are being operated manually, the administrator will see recommendations for migrations that will correct the fault.
VSphere also supports the use of CPU affinity and allows the administrator to assign VMs to one or more of the processors present in a multiprocessor host. These are sometimes called VM-CPU rules and are different from VM-VM and VM-host affinity and anti-affinity rules. CPU affinity is rarely used because stipulating such low-level relationships can inadvertently lead to performance problems, such as ESXi scheduling and load-balancing issues, resource reservation problems, a loss of affinity when migrating the VM to another host and so on.
How do DRS, High Availability and Fault Tolerance ensure high performance?
Become a DRS load-balancing pro with these tips
VSphere 6.5 features improve VM resource management
Dig Deeper on DRS and DPM
Related Q&A from Stephen J. Bigelow
Get to know VMware vSphere's Admission Control tool and use it to reserve the resources necessary for VM failover with cluster resource calculations ... Continue Reading
Use heartbeats, VM monitoring and application monitoring to fully examine the causes of VM unresponsiveness. Adjust sensitivity levels to focus on ... Continue Reading
Combine Distributed Resource Scheduler and vSphere High Availability to design balanced failover clusters. Pay attention to affinity rules, which can... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.