Skip to main content

vSphere DRS Explained

 

vSphere DRS Explained (Improved Version)

DRS Scenario Overview

In the diagram, VM1 and VM2 migrate from ESXi1 to ESXi2 because ESXi2 has lower CPU and memory consumption, currently running only VM5.
Meanwhile, VM3 and VM4 remain on ESXi1 because the host still has sufficient capacity to run them without performance degradation.

ESXi3, which runs VM6, VM7, and VM8, is operating within an acceptable CPU and memory utilization range, so no migrations are needed there.

Through these VM placement decisions, VMware vSphere Distributed Resource Scheduler (DRS) ensures that resource usage across the cluster remains balanced and efficient.


🔧 What is VMware vSphere DRS?

VMware vSphere Distributed Resource Scheduler (DRS) is a workload‑centric scheduling engine that continuously analyzes and balances CPU and memory resources across all ESXi hosts within a cluster.

DRS:

  • Evaluates VM resource demand and host capacity
  • Recommends or automatically performs vMotion migrations
  • Ensures balanced performance across the cluster
  • Works alongside vSphere HA, which restarts VMs after a host failure

After HA restarts VMs on available hosts, DRS re‑balances the cluster by migrating VMs to maintain optimal resource distribution.


DRS Requirements & Limitations

Not supported on single‑host ESXi

DRS requires a cluster with at least two hosts.
Single-node ESXi deployments cannot use DRS because vMotion is required for load balancing.

Perf inconsistencies & affinity rules

In situations where DRS moves workloads too frequently or unpredictably, administrators can enforce DRS affinity rules to control placement behavior.


🔒 DRS Affinity & Anti-Affinity Rules

1. VM‑Host Affinity (Host Rules)

Also known as “must run on” or “should run on” rules:

  • Host Affinity (Node Affinity):
    The VM must stay on a particular host. DRS will not migrate it away.

2. VM‑VM Affinity Rules

Used to control how VMs relate to each other:

  • VM Affinity:
    VMs should run together on the same host.
  • VM Anti-Affinity (Node Anti-Affinity):
    VMs must never run on the same host (common for redundant services like domain controllers, load balancers, or clustered nodes).

📌 Summary

Your scenario demonstrates DRS working correctly:

  • Overloaded hosts → migrate VMs away
  • Underutilized hosts → accept new VMs
  • Balanced hosts → no action needed
  • Affinity rules → prevent unwanted migrations
  • DRS + HA → automatic recovery and resource optimization

🏗️ vSphere DRS – Detailed Architecture Explanation

VMware vSphere Distributed Resource Scheduler (DRS) is a core component of the vSphere Cluster architecture designed to maintain workload performance, resource fairness, and automated VM placement across multiple ESXi hosts. At its heart, DRS transforms a compute cluster into a resource pool with continuous scheduling intelligence, enabling SDDC‑level elasticity similar to cloud platforms.

Below is a complete architectural breakdown of how DRS works.


1. Cluster Architecture Components

A vSphere DRS-enabled cluster comprises the following building blocks:

1. ESXi Hosts

  • Each host contributes its CPU and memory resources to the cluster’s shared compute pool.
  • Hosts must be part of the same vCenter Server instance.
  • vMotion must be enabled for live migrations.

2. vCenter Server

DRS does not run on individual hosts — it runs as a centralized decision-making engine inside vCenter.
vCenter evaluates:

  • Real-time VM demand
  • Host resource availability
  • Constraints (affinity rules, reservations, limits, shares)
  • SDRS, HA, FT, and maintenance mode interactions
  • VM‑level resource utilization patterns (workload centric)

vCenter then sends migration tasks back to ESXi hosts via vMotion.

3. Datastore Layer

While not directly part of CPU/memory DRS, shared storage is required for:

  • vMotion compatibility
  • HA restarts
  • Storage DRS interplay

2. The DRS Scheduling Engine – How Decisions Are Made

DRS evaluates the cluster every 5 minutes by default or when triggered by events such as:

  • VM power-on
  • Host entering/leaving maintenance
  • HA restarts
  • Host over-utilization
  • VM CPU ready time spikes
  • Memory ballooning or swapping

DRS is workload-centric, meaning:

It prioritizes actual VM resource consumption and performance metrics, not just host-level averages.


📊 2.1 Metrics DRS Considers

DRS uses the following metrics intensively:

CPU Metrics

  • CPU ready (%RDY)
  • Co-stop for SMP VMs
  • CPU demand (MHz)
  • NUMA locality scores
  • Host CPU headroom

Memory Metrics

  • Active memory
  • Ballooning/Compression/Swapping
  • NUMA memory locality
  • Host memory pressure (vmmemctl state)

Cluster-Level Metrics

  • Entitlements (Shares × Demand)
  • Overall cluster performance score
  • Host imbalance metric
  • VM entitlement violation score

This gives DRS a full picture of cluster health.


3. DRS Actions Explained

DRS can perform:

1. Initial Placement

When a VM powers on, DRS selects the best host based on:

  • Current load
  • Affinity rules
  • NUMA optimization
  • Resource availability
  • Licensing constraints (e.g., vSphere AI/ML, virtualization features)

2. Load Balancing (vMotion-based migrations)

When hosts become imbalanced, DRS:

  • Calculates the performance impact
  • Predicts host load after migration
  • Suggests moves or automatically performs them (Fully Automated Mode)

3. Host Power Management (DPM) – Optional

If cluster load decreases, DRS can:

  • Evacuate workloads from a host
  • Put the host into standby
  • Bring it online when needed

4. Affinity & Anti-Affinity Rules (Placement Constraints)

These rules override default DRS behavior:

VM–Host Rules (Node Affinity)

  • Must Run On: VM is pinned to a host
  • Should Run On: Preferred host, but flexible

Typically used for:

  • Licensing-bound applications
  • Security/zoning requirements
  • Hardware dependency workloads

VM–VM Rules

  • Affinity: VMs should run together
  • Anti-affinity: VMs must never run together

Used for:

  • Domain controllers
  • Load-balanced web servers
  • Active/standby appliances
  • Cluster nodes (2‑node databases, etc.)

These constraints are binding for all DRS calculations.


5. DRS + HA – Combined Workflow

Even though DRS and HA are separate features, they work in tandem:

Step 1 – Host Failure

  • HA restarts VMs on surviving hosts.

Step 2 – Post-HA Rebalance

  • Hosts may become overloaded after forced restarts.
  • DRS then:
    • Analyzes cluster load
    • Rebalances VMs (migrations)
    • Moves workloads to underutilized hosts

This restores cluster stability after failure recovery.


6. Applying the Architecture to Your Scenario

Your scenario described:

Host Resource Overview

  • ESXi1: Running VMs 1, 2, 3, 4 → Overloaded
  • ESXi2: Only running VM5 → Underutilized
  • ESXi3: Running VMs 6, 7, 8 → Balanced

DRS Decisions Explained

  1. VM1 and VM2 migrate from ESXi1 → ESXi2
    Because ESXi2 has available resources and this move reduces cluster imbalance.

  2. VM3 and VM4 remain on ESXi1
    Their resource consumption does not cause ESXi1 to exceed acceptable thresholds after the migration of VM1 and VM2.

  3. ESXi3 untouched
    Because its workload is neither over-consuming nor significantly under-consuming cluster resources.

Cluster Result

  • CPU/Memory utilization becomes even across hosts
  • Aggregate cluster performance improves
  • VM responsiveness increases
  • NUMA alignment is maintained
  • VM-level entitlements remain honored

This is classic DRS cluster-balancing behavior.


7. Why DRS Is a Workload-Centric Scheduler

Traditional schedulers focus only on balancing host averages.
DRS instead evaluates:

  • Actual VM resource usage patterns
  • Historical demand
  • VM performance degradation indicators
  • NUMA locality
  • Demand spikes vs. entitlement gaps
  • Host contention thresholds

This ensures each VM gets exactly the resources it requires for optimal performance — regardless of host-level averages.


8. Final Architectural Summary

DRS transforms a vSphere cluster into an intelligent compute fabric that:

  • Continuously monitors real-time workload demand
  • Predicts performance degradation
  • Applies live vMotion migrations
  • Ensures optimal VM placement
  • Honors affinity rules and constraints
  • Responds dynamically to failures (HA integration)
  • Maintains CPU/memory fairness
  • Leverages NUMA awareness
  • Enables automated, cloud-like elasticity

This is why DRS is foundational to modern SDDC architecture, especially in VMware Cloud Foundation (VCF), large-scale enterprise clusters, and hybrid cloud deployments.




Comments

Popular posts from this blog

Quick Guide to VCF Automation for VCD Administrators

  Quick Guide to VCF Automation for VCD Administrators VMware Cloud Foundation 9 (VCF 9) has been  released  and with it comes brand new Cloud Management Platform –  VCF Automation (VCFA)  which supercedes both Aria Automation and VMware Cloud Director (VCD). This blog post is intended for those people that know VCD quite well and want to understand how is VCFA similar or different to help them quickly orient in the new direction. It should be emphasized that VCFA is a new solution and not just rebranding of an old one. However it reuses a lot of components from its predecessors. The provider part of VCFA called Tenenat Manager is based on VCD code and the UI and APIs will be familiar to VCD admins, while the tenant part inherist a lot from Aria Automation and especially for VCD end-users will look brand new. Deployment and Architecture VCFA is generaly deployed from VCF Operations Fleet Management (former Aria Suite LCM embeded in VCF Ops. Fleet Management...
  Issue with Aria Automation Custom form Multi Value Picker and Data Grid https://knowledge.broadcom.com/external/article?articleNumber=345960 Products VMware Aria Suite Issue/Introduction Symptoms: Getting  error " Expected Type String but was Object ", w hen trying to use Complex Types in MultiValue Picker on the Aria for Automation Custom Form. Environment VMware vRealize Automation 8.x Cause This issue has been identified where the problem appears when a single column Multi Value Picker or Data Grid is used. Resolution This is a known issue. There is a workaround.  Workaround: As a workaround, try adding one empty column in the Multivalue picker without filling the options. So we can add one more column without filling the value which will be hidden(there is a button in the designer page that will hide the column). This way the end user will receive the same view.  

Step-by-Step Explanation of Ballooning, Compression & Swapping in VMware

 🔹 Step-by-Step Explanation of Ballooning, Compression & Swapping in VMware ⸻ 1️⃣ Memory Ballooning (vmmemctl) Ballooning is the first memory reclamation technique used when ESXi detects memory pressure. ➤ Step-by-Step: How Ballooning Works  1. VMware Tools installs the balloon driver (vmmemctl) inside the guest OS.  2. ESXi detects low free memory on the host.  3. ESXi inflates the balloon in selected VMs.  4. Balloon driver occupies guest memory, making the OS think RAM is full.  5. Guest OS frees idle / unused pages (because it believes memory is needed).  6. ESXi reclaims those freed pages and makes them available to other VMs. Why Ballooning Happens?  • Host free memory is very low.  • ESXi wants the VM to release unused pages before resorting to swapping. Example  • Host memory: 64 GB  • VMs used: 62 GB  • Free: 2 GB → ESXi triggers ballooning  • VM1 (8 GB RAM): Balloon inflates to 2 GB → OS frees 2 GB → ESXi re...