Two components contribute to the memory footprint of the XenServer host. First, the memory consumed by the Xen hypervisor itself. Second, there is the memory consumed by the Control Domain of the host. Also known as ‘Domain0’, or ‘dom0’, the control domain is a secure, privileged Linux VM that runs the XenServer management toolstack (XAPI). Besides providing XenServer management functions, the control domain also runs the driver stack that provides user created VM access to physical devices.
Control domain memory
The amount of memory allocated to the control domain is adjusted automatically and is based on the amount of physical memory on the physical host. By default, XenServer allocates 1 GiB plus 5% of the total physical memory to the control domain, up to an initial maximum of 8 GiB.
The amount reported in the XenServer section in XenCenter includes the memory used by the control domain (dom0), the Xen hypervisor itself, and the crash kernel. Therefore, the amount of memory reported in XenCenter can exceed these values. The amount of memory used by the hypervisor is larger for hosts using more memory.
Change the amount of memory allocated to the control domain
You can change the amount of memory allocated to dom0 by using XenCenter or by using the command line. If you increase the amount of memory allocated to the control domain beyond the amount allocated by default, this action results in less memory being available to VMs.
You might need to increase the amount of memory assigned to the control domain of a XenServer host in the following cases:
- You are running many VMs on the host
- You are using PVS-Accelerator
- You are using read caching
The amount of memory to allocate to the control domain depends on your environment and the requirements of your VMs.
You can monitor the following metrics to judge whether the amount of control domain memory is appropriate for your environment and what effects any changes you make have:
- Swap activity: If the control domain is swapping, increase the control domain memory.
- Tapdisk mode: You can monitor whether your tapdisks are in low-memory mode from within the XenCenter Performance tab for the host. Select Actions > New Graph and choose the Tapdisks in low memory mode graph. If a tapdisk is in low-memory mode, increase the control domain memory.
Pagecache pressure: Use the
topcommand to monitor the
buff/cachemetric. If this number becomes too low, you might want to increase the control domain memory.
For information about changing the dom0 memory by using XenCenter, see Changing the Control Domain Memory in the XenCenter documentation.
You cannot use XenCenter to reduce dom0 memory below the value that was initially set during XenServer installation. To make this change you must use the command line.
On hosts with smaller memory (less than 16 GiB), you might want to reduce the memory allocated to the Control Domain to lower than the installation default value. You can use the command line to make this change. However, we recommend that you do not reduce the dom0 memory below 1 GiB and that you do this operation under the guidance of the Support Team.
On the XenServer host, open a local shell and log on as root.
Type the following:
/opt/xensource/libexec/xen-cmdline --set-xen dom0_mem=<nn>M,max:<nn>M <!--NeedCopy-->
<nn>represents the amount of memory, in MiB, to be allocated to dom0.
Restart the XenServer host using XenCenter or the
rebootcommand on the XenServer console.
When the host restarts, on the XenServer console, run the
freecommand to verify the new memory settings.
How much memory is available to VMs?
To find out how much host memory is available to be assigned to VMs, find the value of the free memory of the host by running
memory-free. Then type the command
vm-compute-maximum-memory to get the actual amount of free memory that can be allocated to the VM. For example:
xe host-list uuid=host_uuid params=memory-free xe vm-compute-maximum-memory vm=vm_name total=host_memory_free_value <!--NeedCopy-->