VMware vSphere has a Distributed Resource Scheduler (DRS) allowing automatic VM placement and vMotion. The purpose of DRS is to make VMs “happy” so they run smoother. DRS can be set to automatically move VMs based on its algorithms, or be set to manual and give recommendations for manually moving VMs.
This post is part of Free VCP-DCV 2021 Study Guide. The main page of the guide is here – VCP7-DCV Study Guide – VCP-DCV 2021 Certification, and you'll find there ALL the chapters.
In vSphere 7.0, DRS uses a new cost modeling algorithm that is flexible and balances network bandwidth together with CPU and memory usage. There is a metric called granted memory which is used for load balancing.
DRS runs once every minute rather than every 5 minutes, as in previous vSphere releases. The newer DRS versions do recommend smaller (in terms of memory) VMs for migration to facilitate faster vMotion migrations. The older DRS versions tend to recommend large virtual machines to minimize the number of migrations.
With vSphere DRS enabled cluster, you can set your DRS to Manually, partially automated, or Fully automated.
The configuration is accessible at the cluster level. You select your cluster > Configure > vSphere DRS.
You'll get to this view where you can click Edit to change the settings.
- Manual – DRS generates both power-on placement recommendations, and migration recommendations for virtual machines. Recommendations need to be manually applied or ignored.
- Partially Automated – DRS automatically places virtual machines onto hosts at VM power-on. Migration recommendations need to be manually applied or ignored.
- Fully Automated (default) – DRS automatically places virtual machines onto hosts at VM power-on, and virtual machines are automatically migrated from one host to another to optimize resource utilization.
In the middle, you can drag the Migration threshold bar. Migration Threshold specifies how aggressively DRS recommends vMotions. Recommendations are generated automatically based on resources demanded by the virtual machines, resource allocation settings (reservations, limits, and shares) the resources provided by each host and the cost of migrating VMs. The more conservative the setting, the less frequent the vMotions.
When you drag the button to the right it will be in Aggressive mode and DRS provides recommendations when workloads are even slightly imbalanced and marginal improvement may be realized. For dynamic workloads, this may generate frequent vMotion recommendations.
Other Options – Predictive DRS
In addition to real-time metrics, DRS will respond to forecasted metrics provided by vRealize Operations Manager. Only forecasted metrics with high confidence will be considered by DRS to balance the cluster’s workloads prior to predicted utilization spikes and resource contention. You must also configure Predictive DRS in a version of vRealize Operations that supports this feature.
Override for individual virtual machines can be set from the VM Overrides page.
What is the VM DRS Score?
The execution efficiency of this virtual machine. Values closer to 0% indicate severe resource contention while values closer to 100% indicate mild to no resource contention. DRS will try to maximize the execution efficiency of each virtual machine in the cluster while ensuring fairness in resource allocation to all virtual machines.
A DRS score is a measure of the resources available for consumption by the VM(s). The higher the DRS score for a VM, the better its resource availability. DRS moves VMs to improve their DRS scores. DRS also calculates a DRS score for a cluster, which is a weighted sum of the DRS scores of all the virtual machines in the cluster. In Sphere 7.0, DRS calculates the core for each virtual machine on each ESXi host in the cluster every minute.
The calculation of an ideal throughput is executed by the DRS logic and an actual throughput for each resource (CPU, memory, and network) for each VM.
The VM’s efficiency for a particular resource is a ratio of the goodness over the demand. A virtual machine’s DRS score (total efficiency) is the product of its CPU, memory, and network efficiencies.
DRS applies resource costs during those calculations. There are costs for CPU cache, CPU ready and CPU tax. Same for memory where DRS takes into accounts the costs for memory burstiness, memory reclamation, and memory tax.
There are also network resources costs as well as utilization, involved. DRS does the comparison of the VM's DRS score for the host where the VM is currently running on. The DRS system makes sure that the host where it actually runs can provide the best DRS score for that particular VM. If not, it calculates migration costs. If all those factors matches and the system sees better DRS score on another host, it makes the vMotion recommendation.
DRS and Affinity Rules
The VMware documentation covering VM-Host Affinity Rules. You can find there how to add host affinity must rule. Basically, the VM-host affinity rule specifies whether the rule is a requirement (“must”) or a preference (“should”) and whether it is affinity (“run on”) or anti-affinity (“not run on”).
VM-VM affinity and anti-affinity rules are similar. It specifies if selected VMs should run on the same host or be kept on separate hosts. These rules are typically used to create affinity or anti-affinity between individual VMs.
Watch out for conflicts here, because you can have multiple VM-VM affinity rules in different directions causing conflicts. For example, you can have one rule that keeps 2 VMs on separate hosts, while another rule puts them together. You need to select one of the rules to apply and disable or remove the rule that's in conflict.
Thanks for reading.
- VMware VCP7-DCV Exam page here.
- VCP6.7-DCV Study Guide – VCP-DCV 2019 certification
More posts from ESX Virtualization:
- vSphere 7.0 Download Now Available
- vSphere 7.0 Page [All details about vSphere and related products here]
- VMware vSphere 7.0 Announced – vCenter Server Details
- VMware vSphere 7.0 DRS Improvements – What's New
- How to Patch vCenter Server Appliance (VCSA) – [Guide]
- What is The Difference between VMware vSphere, ESXi and vCenter
- How to Configure VMware High Availability (HA) Cluster