Dynamic Memory Control (DMC)

XenServer DMC (sometimes known as “dynamic memory optimization”, “memory overcommit” or “memory ballooning”) works by automatically adjusting the memory of running VMs, keeping the amount of memory allocated to each VM between specified minimum and maximum memory values, guaranteeing performance and permitting greater density of VMs per server.

Without DMC, when a server is full, starting further VMs will fail with “out of memory” errors. To reduce the existing VM memory allocation and make room for more VMs you must edit each VM’s memory allocation and then reboot the VM. With DMC enabled, even when the server is full, XenServer will attempt to reclaim memory by automatically reducing the current memory allocation of running VMs within their defined memory ranges.

Dynamic and static memory range

For each VM, you can set a dynamic memory range which is the range within which memory can be added/removed from the VM without requiring a reboot. You can adjust the dynamic range while the VM is running, without having to reboot it. XenServer always guarantees to keep the amount of memory allocated to the VM within the dynamic range. For example, if the Dynamic Minimum Memory was set at 512 MB and the Dynamic Maximum Memory was set at 1024 MB, this would give the VM a Dynamic Memory Range (DMR) of 512 - 1024 MB, within which it would operate. With DMC, XenServer guarantees at all times to assign each VM memory within its specified DMR.

When the host server’s memory is plentiful, all running VMs will receive their Dynamic Maximum Memory level; when the host’s memory is scarce, all running VMs will receive their Dynamic Minimum Memory level. If new VMs are required to start on “full” servers, running VMs have their memory “squeezed” to start new ones. The required extra memory is obtained by squeezing the existing running VMs proportionally within their pre-defined dynamic ranges.

Many Operating Systems that XenServer supports do not fully support dynamically adding or removing memory. As a result, XenServer must declare the maximum amount of memory that a VM will ever be asked to consume at the time that the VM boots to allow the guest operating system to size its page tables and other memory management structures accordingly. This introduces the concept of a static memory range within XenServer. The static memory range cannot be adjusted while the VM is running, and the dynamic range is constrained such as to be always contained within this static range until the VM is next rebooted. Note that the static minimum (the lower bound of the static range) is there to protect the administrator and is set to the lowest amount of memory that the OS can run with on XenServer.

Important: Citrix advises you not to change the static minimum level as this is set at the supported level per operating system: refer to the XenServer Administrator’s Guide for more details. By setting a static maximum level higher than a dynamic max, if you need to allocate more memory to a VM in the future, you can do so without requiring a reboot.

DMC memory constraints

XenCenter enforces the following constraints when setting DMC values:

  • The minimum dynamic memory value cannot be lower than the static minimum memory value.
  • The minimum dynamic memory value cannot be greater than the maximum dynamic memory value.
  • The maximum dynamic memory value cannot be greater than the maximum static memory value.

You can change a VM’s memory properties to any values that satisfy these constraints, subject to validation checks. In addition to these constraints, Citrix supports only certain VM memory configurations for specific operating system; these are detailed in the XenServer Administrator’s Guide.