📄 Proxmox 9: VM best practices

Proxmox 9: VM best practices

The upgrade to Proxmox 9 introduces a significant amount of new functionality, not only for the system itself but also for your VMs & Containers. Through this message, we would like to inform you of new hardware configuration options that can accelerate your VMs!

Most options are derived from the following documentation: https://pve.proxmox.com/wiki/QEMU/KVM_Virtual_Machines


Machine

Version

We have found substantial improvements in newer 'Machine' versions for QEMU, so it is certainly worth updating to a newer version! Note that older versions will be gradually phased out starting from Proxmox 9. This is definitely something to keep an eye on.

More information can be found here: https://pve.proxmox.com/wiki/QEMU_Machine_Version_Upgrade

TLDR: Update to new QEMU machine type

SCSI Controller

Type

Previously, the default was set to virtio-scsi; this has now been replaced by the newer virtio-scsi-single controller. The benefit of the new controller lies in the underlying process, where each disk now receives its own thread and can provide optimal IO performance without being limited by a multi-disk setup. (see IO-thread)

More information about the various types of controllers can be found here: https://pve.proxmox.com/wiki/QEMU/KVM_Virtual_Machines#qm_hard_disk

TLDR: Update to new virtio-scsi-single controller

Harddisk

SSD

If you are using an SSD / NVMe disk / pool for your VMs, it is highly recommended to enable this option. By enabling this, the operating system recognizes whether the disk is a 'rotational device' or not. Some applications, such as MySQL, may behave differently regarding query logging as a result.

TLDR: Enable SSD if an SSD / NVMe disk is being used

Cache

  • Default (No cache): This remains the safest option; by not using a cache, there is no risk of data loss within the VM in the event of an unexpected VM / node failure.

  • Write Back: If you wish to use disk caching, we recommend the Write-back cache. This provides the best balance between performance & safety if you do choose to use caching.

More information about disk-cache can be found here: https://pve.proxmox.com/wiki/Performance_Tweaks#Disk_Cache

TLDR: Off for safety, write-back for performance

Discard

If your underlying storage is 'thin provisioned', enable discard by default; this ensures that old data is removed from the disks after you have deleted it within your environment.

More information about discard can be found here: https://pve.proxmox.com/wiki/Qemu/KVM_Virtual_Machines#qm_hard_disk_discard

TLDR: Enable discard on thin-provisioned storage

IO-Thread:

When combined with the virtio-scsi-single controller, enable the IO-thread option; the performance difference is particularly noticeable on machines running IO-intensive applications and with multiple disks.

More information about discard can be found here: https://pve.proxmox.com/wiki/Qemu/KVM_Virtual_Machines#qm_hard_disk_iothread


CPUs

Type

KVM64 has been replaced as the default CPU type; we now recommend CPUs for the x86-v64-x generation. This new model offers improved CPU & IO performance compared to its predecessor -by many folds! We have measured that the higher the generation, the faster the CPU performs.

You can find the exact list of CPU models compatible with your CPU generation here: https://www.qemu.org/docs/master/system/i386/cpu.html#id1

TLDR: Update to x86-v64-vX CPU type (keeping in mind your host cpu generation)

NUMA (advanced)

When your host has a multi socket cpu your guest could benefit using this. This is because the guest is then aware and can optimize scheduling multithreaded tasks.

This option is also required to hot-plug cores or RAM in a VM.

More information about NUMA can be found here: https://pve.proxmox.com/wiki/QEMU/KVM_Virtual_Machines#_numa


Memory

For your memory it is recommended to use a multiple of 1024 MiB, where this is equivalent to 1 GiB.
So when you want to assign 16GiB of memory to a guest, use the following: 1024 * 16 = 16384 MiB

Ballooning device (advanced)

Ballooning is usefull when you want to dynamically scale the memory usage on the host. It also helps with insights into the memory device from the proxmox host.

This is enabled by default inside proxmox, but needs to be supported inside the VM to work.
When this is enabled, by default it will set the minimum memory equal to the allocated memory. This makes sure you still get the advantage of memory insights.

More information about ballooning can be found here: https://pve.proxmox.com/wiki/QEMU/KVM_Virtual_Machines#qm_ballooning


Network

For your network device

Multiqueue (advanced)

This option allows the guest OS to process networking packets using multiple virtual CPUs, providing an increase in the total number of packets transferred.
When using Multiqueue, it is recommended to set it to a maximum of the number of vCPUs of your guest.

You also need to set the number of multi-purpose channels on each VirtIO NIC in the VM with this ethtool command:

ethtool -L ens1 combined X

In Windows you will need the VirtIO Ethernet Adapter drivers and enable it on the NIC inside the VM.

More information about multiqueues can be found here: https://pve.proxmox.com/wiki/QEMU/KVM_Virtual_Machines#qm_network_device


VirtIO RNG

A RNG (Random Number Generator) is a device providing entropy (randomness) to a system. A virtual hardware-RNG can be used to provide such entropy from the host system to a guest VM. This helps to avoid entropy starvation problems in the guest (a situation where not enough entropy is available and the system may slow down or run into problems), especially during the guests boot process.

More information can be read here: https://pve.proxmox.com/wiki/QEMU/KVM_Virtual_Machines#qm_virtio_rng


Qemu guest agent

The qemu guest agent is a program installed in the guest qemu VM and helps with properly shutting down the vm or keeping backups consistent. It is always recommended to install this.

Information about the qemu guest agent can be found here: https://pve.proxmox.com/wiki/Qemu-guest-agent

(Windows) VirtIO drivers

The Virtio drivers for windows help support the virtualized hardware and will also install the qemu guest agent.

Recommended version:

Both Proxmox and Tuxis recommend using only VirtIO driver version: 'virtio-win-0.1.271-1'. Many consider this to be the most stable driver version; newer and older versions have frequent reports regarding performance degradation.

More information can be found here: https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers

TLDR: Ensure VirtIO drivers 0.1.271 are installed.
💡

Version virtio-win-0.1.302-1 has been released, but we recommend restraint on using this version until we have tested this fully! 
We will change the recommendation here when we support this version!

This can be downloaded from the following page: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/ 


(Windows) Tablet Device

Within the Proxmox VM options, it is recommended to disable the 'USB Tablet device'; this results in lower idle CPU usage and fewer context switches.

Information about this issue can be found at the end of this page: https://pve.proxmox.com/wiki/Performance_Tweaks#USB_Tablet_Device