When it comes to memory tuning of KVM guests there are few options available, depending on the workload of the virtual machine. One such option is Linux HugePages.
Most Linux hosts by default address memory in 4 KB segments, named pages. However, the kernel is capable of using larger page sizes. Using HugePages (pages bigger than 4 KB) may improve performance by increasing the CPU cache hits against the transaction Lookaside Buffer (TLB). The TLB is a memory cache that stores recent translations of virtual memory to physical addresses for quick retrieval.
In this recipe, we are going to enable and set HugePages on the hypervisor and the KVM guest, then examine the tuning options that the
virsh command provides.
For this recipe, we are going to need the following:
- An Ubuntu host, with libvirt and QEMU installed and configured
- A running KVM virtual machine