8.2. Memory Tuning Tips
To optimize memory performance in a virtualized environment, consider the following:
- Do not allocate more resources to guest than it will use.
- If possible, assign a guest to a single NUMA node, providing that resources are sufficient on that NUMA node. For more information on using NUMA, see Chapter 9, NUMA.
- When increasing the amount of memory a guest virtual machine can use while the guest is running, also referred to as hot plugging, the memory needs to be manually brought online on the guest by one of the following methods:
- Create a custom udev rule
- Create a file with a name that ends in the .rulessuffix in the
/etc/udev/rules.d/
directory:# touch /etc/udev/rules.d/rulename.rules
- Add the memory onlining to the created file:
# echo 'SUBSYSTEM=="memory", ACTION=="add", ATTR{state}=="offline", ATTR{state}="online"' > /etc/udev/rules.d/rulename.rules
- Reload udev rules:
# udevadm control --reload
- Bring inactive memory online manually after each hot plug
# for mblock in /sys/devices/system/memory/memory*; do echo online > $mblock/state; done