DRS — balancing VMs across cluster nodes
DRS (Distributed Resource Scheduler) is a Center service that watches the load of cluster nodes and moves running virtual machines (VMs) from busy nodes to free ones. It moves them with live migration: the VM keeps running, and its disks stay in their pool. With DRS enabled, Center also uses its data to pick the node a VM starts on.
After the upgrade to 3.3, DRS is off. The Cluster master enables it — Enable and configure DRS.
DRS is managed on the cluster page, on the DRS Compute tab. The DRS Storage tab next to it is inactive: 3.3 does not move disks between pools to even out the load.
What DRS counts as load
DRS does not look at the instant load of a node but at how much of the node its VMs need — the DRS load:
- CPU — how many logical CPUs of the node the VMs used on average over the last 15 minutes (for VMs with up to 4 GB of RAM) or 40 minutes (for VMs over 4 GB). Averaging keeps a short spike from moving a VM.
- RAM — how much RAM is granted to the VMs of the node, minus the memory the guest OSes have returned to the node (balloon).
- Node capacity — its logical CPUs and physical RAM minus the RAM kept for the ZFS ARC cache and the OS memory reserve of the node.
The load is the VM demand as a percentage of the node capacity. It differs from Used on the Resources tab: that one is actual consumption over the last three minutes, this one is the averaged demand of the VMs.
How DRS decides what to move
DRS works in passes. A pass starts every Pass interval, s — once a minute by default — or right away when you click Run DRS.
- DRS rates the "strain" of each node. The closer the load gets to 100 %, the steeper the rating grows: at 50 % it is 2, at 75 % — 4, at 90 % — 10, at 95 % — 20. So the difference between 85 % and 95 % affects the rating much more than the difference between 20 % and 30 %: DRS relieves nearly full nodes first and does not affect lightly loaded nodes.
- It adds up the ratings of all nodes for CPU and RAM. The sum is smallest when all nodes are loaded equally. How much the current sum exceeds that minimum is the cluster imbalance.
- It tries VM moves and looks for those that reduce the imbalance the most. A move is proposed only if its benefit exceeds the cost of the move and the threshold of the selected level. The cost grows with the VM's RAM: the more RAM, the longer the move takes.
- It builds a plan. In one pass DRS can propose several moves, including a chain: a node that takes one VM gives away another.
An example with numbers
The cluster has two nodes with 32 logical CPUs each. For simplicity, only CPU is counted.
| Node A | Node B | Sum of ratings | |
|---|---|---|---|
| Now | VMs use 24 CPUs — 75 %, rating 4 | 8 CPUs — 25 %, rating 1.33 | 5.33 |
| Ideal — equal load | 50 %, rating 2 | 50 %, rating 2 | 4 |
The imbalance is 5.33 − 4 = 1.33. Node A runs the VMs db-01 (8 CPUs on average) and web-01 (4 CPUs). DRS compares the moves:
web-01to B: A at 62.5 % (rating 2.67), B at 37.5 % (1.6). The sum is 4.27: the imbalance drops by 1.06 of 1.33, that is, by 80 %.db-01to B: both nodes at 50 %, the sum is 4 — the imbalance is eliminated completely, by 100 %.
DRS proposes moving db-01 from A to B with the reason Node CPU load — unless moving db-01 is much more expensive because of the size of its RAM. In the explanation of the recommendation, the Cluster imbalance reduced by row shows 100 %.
Protection from repeated VM moves
- Moving a recently moved VM costs more. The penalty decays over 40 minutes. On the Faults tab such a VM is shown with the time it becomes available.
- The reverse move costs more. If DRS recently moved a VM from node A to B for CPU, a move from B to A for CPU gets a cost penalty that decays over 40 minutes. A move with a large enough benefit can still be made earlier. A move for the other resource gets no penalty.
- Load fluctuations are ignored. If the benefit of a move does not exceed the usual fluctuations of node load, DRS waits for the load to stabilize.
- Pause after a failed migration. If the live migration of a VM did not converge or was terminated, DRS does not propose moving that VM for 40 minutes.
Automation levels
The automation level determines which actions DRS performs automatically and which it proposes to a user.
| Level | VM start | Moves to even out the load |
|---|---|---|
| Manual | When you start a VM from the Center web interface, Center asks for the node and marks the recommended one: Recommended. When a VM is started through the API, the node is picked automatically | DRS only proposes moves — recommendations; a user applies them |
| Partially Automated (default) | Center picks the node automatically | DRS proposes moves; a user applies them |
| Fully Automated | Center picks the node automatically | DRS moves VMs automatically |
You can set the level separately for a VM and for a VDC — Override the DRS level for VMs and VDCs. That page also describes the Disabled level: DRS does not move a VM with this level.
If the cluster level is Fully Automated and a VM has the Manual or Partially Automated level, DRS creates no recommendations for that VM. If the cluster level is Manual or Partially Automated and a VM has Fully Automated, DRS moves that VM automatically.
Migration threshold
The threshold determines how large the benefit must be for DRS to propose a move.
| Threshold | What DRS does |
|---|---|
| 1 — Mandatory only | Mandatory migrations only: placement rules and maintenance mode. Does not even out the load |
| 2 — Conservative | Moves VMs only when the load is heavily imbalanced or a node does not meet VM demand. The benefit must hold for two passes in a row |
| 3 — Balanced (default) | Moves VMs when the load is moderately imbalanced. Suits stable workloads |
| 4 — Elevated | Moves VMs when the load is noticeably imbalanced. Suits bursty workloads |
| 5 — Aggressive | Moves VMs even when the load is slightly imbalanced. With changing workloads, migrations may be frequent |
In the recommendations table, the Priority column shows the threshold from which a move would appear: Appears from level 2 is a strong recommendation that would pass even at the conservative threshold.
Enable and configure DRS
You need the Cluster master role.
- In the left menu, select Provider Data Center → the cluster name and open the DRS Compute tab.
- Click ⋯ on the right of the tab header and select DRS settings. A panel opens on the right.
- Turn on Enable DRS.
- Set the numbers:
- Pass interval, s — how often a pass runs, from 60 to 3600 seconds;
- Outgoing migrations per node — from 1 to 18, 8 by default. The limit applies to all live migrations of VMs from the node to another node, including manual ones, starting with the next migration. Moving disks does not count toward the limit: it waits for a free port in its own queue.
- Select the Automation level and the Migration threshold.
- Click Save.
Center shows the notification DRS settings saved. The tab header shows Enabled / <level> and Migration threshold <N> of 5. The change is written to the security event log and to Tasks as Change DRS settings — with the old and new values.
If another user changed the settings in the meantime, Center rejects the change with the message "DRS settings were changed by another user. Reload to see them". Close the panel, reload the page and try again.
Turning DRS off keeps the level, the threshold and the overrides: they are restored the next time DRS is turned on.
Emergency switch to manual mode
If three of the last five moves that DRS started automatically failed, DRS switches the cluster to the Manual level. It does not interrupt running migrations. The DRS tab shows the warning "DRS switched to Manual: <N> of the last 5 DRS migrations failed…" with links to the failed tasks, and Tasks shows the DRS emergency switch to Manual task.
Find out why these tasks failed. Then open DRS settings, select an automation level other than Manual and click Save — the warning disappears, and the failure counter is reset. While the level stays Manual, the Save button is inactive: to clear the warning and stay on Manual, call the drs-settings-set API method with automation_level: manual.
Access rights
| Privilege | What it gives | Built-in roles |
|---|---|---|
| "View DRS" | the DRS tab: node load, recommendations, faults, history; rules and groups — if the role is assigned to the whole cluster | Cluster master, Resource viewer |
| "Configure DRS" | DRS settings, VM and VDC overrides, rules and groups | Cluster master |
| "Apply DRS Recommendations" | Apply, Run DRS, DRS simulation | Cluster master |
A custom role with "View DRS" assigned in a VDC sees recommendations, faults and history only for the VMs of its VDCs and without load numbers. In the web interface, the Resource viewer sees only the Resources tab of the cluster; it has no DRS tab.
DRS and other features
- VM start and auto-restart. With DRS enabled, a VM start without a chosen node and the auto-restart after a failure pick the node by the DRS load of the last pass. With DRS off, the node is picked the same way as before.
- Node maintenance mode. DRS also makes the moves of VMs and their disks off a node that enters maintenance — with the reason Host maintenance. Node maintenance mode
- Placement rules. DRS does not violate the Keep VMs together, Separate VMs and mandatory VMs to nodes rules and proposes moves to fix violated ones. DRS rules and groups
- Failover memory reserve — DRS does not check it. Failover memory reserve
- A single node. In a single-node cluster DRS cannot move VMs — the tab shows the message The cluster has one node: DRS has nowhere to migrate VMs.
- Routers — DRS does not move them to even out the load.
Next
- View the load and apply DRS recommendations
- DRS rules and groups
- Override the DRS level for VMs and VDCs
- DRS simulation
- Live migration of a VM
API methods: drs-settings-get, drs-settings-set, drs-run — in the API reference.