Skip to main content

Memory reserve for node failures

Center does not allow VMs (virtual machines) to take the memory that will be needed to start the VMs of failed nodes. A cluster that survives a failure of x nodes is called N+x. Center keeps the memory of the x largest nodes in reserve and refuses to power on a VM if that would require memory from the reserve. This ensures that after a node failure, memory remains on the other nodes for its VMs.

What x means​

x is how many nodes the cluster can lose. Center takes the smaller of two numbers:

  • Pool redundancy. How many disks may fail in a pool: RAID-Z1 — 1, RAID-Z2 — 2, a mirror — its disks minus one, a single-disk pool — 0. The smallest value over all pools in service is taken — Storage redundancy and disk recovery.
  • Quorum. How many nodes can be lost so that more than half remain in service: 3–4 nodes — 1, 5–6 — 2, from 7 — 3. A two-node cluster — 1, a one-node cluster — 0.

x is never greater than 3. For example, 5 nodes with RAID-Z2 is N+2, and 4 nodes with RAID-Z2 is N+1: the quorum does not allow more than one node.

Center determines x itself at each start, from what the nodes report about the pools. It cannot be set manually. If the nodes did not respond, Center takes the pool redundancy determined last time, and if there is none, it assumes redundancy 1; the quorum is taken into account in the same way.

How the reserve is calculated​

  1. Node capacity is the memory the node provides to VMs: the latest measurement of physical memory minus the maximum ZFS ARC cache size and minus the memory reserve for vStack OS, if one is recorded for the node. While there is no measurement, the node capacity is 0 — Resource accounting: quotas and node memory.
  2. Unavailable nodes are failed nodes or nodes in maintenance mode. A node disabled in the cluster is not one of them, but its capacity is not counted either.
  3. Tolerance now is x minus the number of unavailable nodes, not less than 0.
  4. The reserve is the sum of capacities of as many of the largest available nodes as the tolerance now.
  5. Memory for VMs is the sum of capacities of the available nodes minus the reserve.
  6. The load is the memory of all VMs that occupy nodes, plus VMs that are now starting, resuming or being recovered after a node failure.

A power-on passes if the load plus the memory of the VM being powered on is not greater than the memory for VMs.

Example​

A cluster of 4 nodes, N+1. Three nodes have a capacity of 256 GB each, the fourth — 384 GB.

  • The reserve is the capacity of one largest node: 384 GB.
  • Memory for VMs: 256 + 256 + 256 + 384 − 384 = 768 GB.
  • VMs with 700 GB are running. A 64 GB VM powers on: 700 + 64 = 764 GB, not greater than 768.
  • The next 16 GB VM does not power on: 764 + 16 = 780 GB, greater than 768.

The reason: if the 384 GB node fails, its VMs must be started on the three remaining nodes, which have 768 GB together. If the load is not greater than 768 GB, the VMs will fit.

When a node has failed or entered maintenance, the tolerance now is 1 − 1 = 0, and no reserve is kept anymore: VMs can be powered on within the capacity of the remaining nodes. If a 256 GB node failed in the example, the memory for VMs is 256 + 256 + 384 = 896 GB.

What the reserve refuses​

The reserve is checked by:

  • Start and Start at node;
  • Restart of a powered-off VM — a running VM is already in the load;
  • Resume of a VM;
  • resuming a pool — its suspended VMs are counted.

If a power-on does not pass, Center refuses with the code -440 and the text Not enough RAM in the cluster outside the failover reserve. The text names no numbers or nodes. In the Start at node window, nodes that fit by memory are shown as refused with the Failover reserve reason.

The same code -440 is used by the memory refusal of one node — Cluster RAM has been depleted, which is a different check. You can tell them apart by error.data.reason: the reserve refusal has failover_reserve.

What the reserve does not check​

  • VM auto-restart after a failure and VM recovery after a node failure — the reserve exists for these cases — VM auto-restart after a failure.
  • VM creation.
  • VM migration — manual and in node maintenance mode.
  • DRS moves — DRS.

These actions can use up the reserve. In this case, subsequent power-ons are refused until memory is freed.

Where the state is shown​

The cluster-totals API method returns the reserve state:

FieldWhat it means
ram_totalmemory for VMs, bytes: the sum of capacities of the available nodes minus the reserve
failover_tolerancex — how many nodes the cluster can lose by design, 0–3
failover_tolerance_nowtolerance now: x minus the unavailable nodes
sourcewhere the pool redundancy comes from: pool — the nodes' answer, saved — the previous value, default — 1 is assumed
unavailable_nodesunavailable nodes: node_id, node_name, state — failed (failure) or maintenance (maintenance)
determined_atwhen the nodes last reported about the pools, UTC; null — never

In 3.2, the ram_total field was all node memory; now it is the memory minus the reserve. The cluster memory summary in the web interface calculates percentages from this number.

After upgrading from 3.2​

In 3.2 there was no reserve, and VMs could occupy all node memory. After the upgrade, the memory for VMs shrinks by the reserve. If the load is already larger than the memory for VMs, Center rejects with code -440 every power-on, Restart of a powered-off VM and resume until the load becomes smaller. Running VMs keep running; automatic VM restart and recovery after a node failure do not check the reserve.

Before the upgrade, calculate the memory for VMs using the rules above and compare it with the memory of the VMs that occupy the nodes. If the memory for VMs is not enough, power off some VMs in advance, reduce their memory or add a node to the cluster.

Limitations​

  • x is determined when Center starts. If the pool redundancy changes after that, x is updated only at the next start. Center tracks unavailable nodes all the time.
  • Capacity comes from measurement. The capacity of a node without a memory measurement is 0, and VMs on it cannot be powered on.
  • N+0 means no reserve. At x = 0 or when x nodes are already unavailable, no reserve is kept, and putting a node into maintenance mode is refused — Put a node into maintenance mode.

What not to do​

  • Do not power on VMs bypassing the reserve by migration or creation to use the reserved memory: after a node failure, its VMs cannot be started on the remaining nodes.
  • Do not allocate excess memory to VMs: the load includes the full configured VM memory.

See also​