Mike Kiev - Fotolia
The affinity and anti-affinity rules available in VMware Distributed Resource Scheduler can guide VM-host and VM-VM...
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 VMware ESXi, vSphere and vCenter
Related Q&A from Stephen J. Bigelow
Some enterprises avoid the public cloud due to its multi-tenant nature and data security concerns. Learn what data separation is and how it can keep ... Continue Reading
There are advantages and disadvantages to using NAS or object storage for unstructured data. Find out what to consider when it comes to scalability, ... Continue Reading
Knowing hardware maximums and VM limits ensures you don't overload the system. Learn hypervisor scalability limits for Hyper-V, vSphere, ESXi and ... Continue Reading