When designing/configuring a DRS cluster it is important to size the virtual machines within the cluster correctly. Likewise, it’s important to size your clusters correctly for the virtual machine workloads you intend to run. Virtual machines that have smaller memory allocations and fewer virtual CPUs assigned give DRS more chance of migrating them in order to improve cluster performance. It’s important to give virtual machines only the amount of memory and vCPU resources that they actually need. Virtual machines that have over-allocated resources can cause DRS to be less efficient than it otherwise would be. This can lead to a cluster becoming over committed or invalid.
vCenter will alert you to these conditions by a presenting a yellow warning when the cluster is over committed and a red warning when the cluster is invalid. There are a number of possible causes for a cluster to become over committed or invalid, including:
- In the event of a host failure a cluster can become over committed due to the reduced amount of physical resources available.
- A cluster will become invalid in vCenter if a virtual machine is powered on outside the control of vCenter (e.g. connecting the vSphere client/PowerCLI directly to a host, therefore bypassing vCenter if it is unavailable)
- Likewise, if changes to a virtual machine are made outside of vCenter, then the cluster may be invalid once the host regains connectivity to vCenter.
Its important to set the resource settings for virtual machines carefully. This includes reservations, limits and shares. Setting reservations too high can leave too few spare resources in the cluster, limiting the effectiveness of DRS.
Along with over allocated virtual machines, another thing that can impact DRS efficiency is affinity rules.
DRS Affinity / Anti-Affinity Rules
DRS efficiency can be impacted by DRS Affinity and Anti-Affinity rules. There are two types of affinity rule:
- VM-VM Affinity
- VM-Host Affinity
When you have a lot of VM-VM affinity rules there is a chance that there will be conflicts, which DRS will attempt to resolve. DRS will always give precedence to older affinity rules over younger affinity rules. DRS also give precedence to preventing violations of anti-affinity rules, ahead of violating affinity rules.
With VM-Host Affinity rules there are Must Run rules and Preferential rules. Like with VM-VM Affinity rules, older rules will take precedence over newer/younger rules.
In the case of Must Run on/Must Not Run on VM-Host affinity rules, DRS will not take any action to violate those rules. As a result the cluster will not carry out certain functions if the result is to violate ‘Must’ rules. These include:
- DRS evacuating a host when a host is placed into maintenance mode
- HA failover
- Initial placement of a virtual machine
- DRS/DPM evacuating a host and placing it into standby mode
Due to the impact ‘Must’ rules can have on DRS efficiency, it is generally recommended to avoid using them where possible.