Menu Home

Proxmox Tuning – Part 1 (VM CPU Tuning and 1GB HugePages in Ubuntu VMs)

With the release of Ubuntu 26.04 LTS, I’ve started to rebuild some of my VMs from 24.04 and took the opportunity to polish the proxmox VM settings.

Proxmox: VM CPU Tuning

Notice: The details below are about my AMD EYPC Server CPUs, but for proxmox environments with only Intel or mixed cluster hosts, you should be able to detect the flags for every host in your cluster and the pick the commonly supported CPU flags.

Context: I’ve been running VMs without AES HW acceleration for years when it’s an easy win.

Because I’ve been using the default “x86-64-v3” CPU type for my EYPC ZEN2 and ZEN3 servers… I’ve been leaving some additional extra CPU flags disabled when they’re perfectly supported by my proxmox hosts.

This means I can enable them by default and then migrate the VMs from host to host without issue.

I’ve added the following flags to the VM template so it’s now used by default `+pdpe1gb +aes +ibpb +ssbd`

  • ibpb – Allows improved Spectre mitigation with AMD CPUs.
  • virt-ssbd – Basis for ‘Speculative Store Bypass’ protection for AMD models.
  • amd-ssbd – Improves Spectre mitigation performance with AMD CPUs, best used with ‘virt-ssbd’.
  • pdpe1gb – Allow guest OS to use 1GB size pages, if host HW supports it.
  • aes – Activate AES instruction set for HW acceleration.

and enabled NUMA by default even on single socket EYPC motherboards. The EYPC CCD design makes the NUMA required.

This should make a small but hopefully noticeable difference on my systems performance on the VMs running the updated default settings.

Proxmox: Disable KSM and Balloon Memory with HugePages support

Proxmox side

Both Memory ballooning (Proxmox’s dynamic memory allocation) and KSM (Kernel Samepage Merging) conflict with HugePages. Disable both on the VM.

Ubuntu Side with 2MB hugepages

# Edit grub
nano /etc/default/grub

# Find this line and add hugepagesz options:
GRUB_CMDLINE_LINUX_DEFAULT="quiet hugepagesz=2M hugepages=5000 transparent_hugepage=never"

update-grub
reboot


Note: transparent huge pages (THP) only works with 2MB pages:

The three modes
always — kernel automatically tries to collapse any eligible memory into huge pages for every process, whether they asked for it or not. Most aggressive, most likely to cause latency spikes.
madvise — only uses huge pages for memory regions where the application explicitly requests it via the madvise(MADV_HUGEPAGE) syscall. Opt-in per allocation.
never — THP completely disabled, kernel never uses transparent huge pages for anything.

Ubuntu Side with 1GB hugepages

# Edit grub
nano /etc/default/grub

# Find this line and add hugepagesz options:
GRUB_CMDLINE_LINUX_DEFAULT="quiet hugepagesz=1G hugepages=10"

# Update grub
update-grub

# Reboot
reboot

The following shows that the VM is correctly allocating 1

Categories: Uncategorised

shlee

Leave a Reply

Your email address will not be published. Required fields are marked *

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)