Set CPU type to "host" for a Windows VM as a best practice

Fra

Renowned Member
Dec 10, 2011
143
10
83
Last edited:
Be aware though, that this could prevent live migrations from working. If the host you are migrating to doesn't cover the cpu features of the old host, it could fail and crash (the vm).
 
  • Like
Reactions: Fra
Since we are here I am wondering if, with the above limit of the live migration, should we expect a performance gain by setting CPU type to host for VM with linux (Ubuntu) ?
 
In my case a simulated CPU performed faster than the Host!

I've had a couple of months painfully working on a molases-level sluggish Windows 10 VM. I've tried every setting and tweak I could think of.

Weirdly enough, as I changed the CPU from Host to x86-64-v3 or even kvm64, I got the rocket speed back.

This is very strange, I know. How can a simulated CPU perform faster than the Host? I don't know, but for now I have less risk of a heart attack.

As a background, this VM was installed with a Host CPU on a different server, then migrated to the current one. Of course pre-migration the CPU was set to "default" (kvm64), then back to Host after successful migration (and test run).

So, any idea why this could be the case?
 
  • Like
Reactions: patefoniq

On the benefit the doc helps 100% (see below)


indeed my advice was to mention this big difference in the above wiki "windows best practices"

____________________________________________________​

From:​

https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_virtual_machines_settings



CPU Type​


QEMU can emulate a number different of CPU types from 486 to the latest Xeonprocessors. Each new processor generation adds new features, like hardwareassisted 3d rendering, random number generation, memory protection, etc.. Also,a current generation can be upgraded through microcode update with bug orsecurity fixes.

Usually you should select for your VM a processor type which closely matches theCPU of the host system, as it means that the host CPU features (also called CPUflags ) will be available in your VMs. If you want an exact match, you can setthe CPU type to host in which case the VM will have exactly the same CPU flagsas your host system.

This has a downside though. If you want to do a live migration of VMs betweendifferent hosts, your VM might end up on a new system with a different CPU typeor a different microcode version.If the CPU flags passed to the guest are missing, the QEMU process will stop. Toremedy this QEMU has also its own virtual CPU types, that Proxmox VE uses by default.

The backend default is kvm64 which works on essentially all x86_64 host CPUsand the UI default when creating a new VM is x86-64-v2-AES, which requires ahost CPU starting from Westmere for Intel or at least a fourth generationOpteron for AMD.

In short:

If you don’t care about live migration or have a homogeneous cluster where all nodes have the same CPU and same microcode version, set the CPU type to host, as in theory this will give your guests maximum performance.

If you care about live migration and security, and you have only Intel CPUs oronly AMD CPUs, choose the lowest generation CPU model of your cluster.

If you care about live migration without security, or have mixed Intel/AMDcluster, choose the lowest compatible virtual QEMU CPU type.
 
Testing trumps best practise.
Or rather painfully testing -> after months of running on "Host" type CPU on our AMD EPYC 9354 Hosts, and having huge CPU Loads and spikes inside VMS
we tested all modern vCPU types and found best "AMD EPYC GENOA" even though it is a physical genoa underneath.
We also adjusted/set some CPU flags:
pdpe 1gb, hv-tlbflush, AES

now VMs handle CPU rather nicely

so if your experience is similar, find the next best emul.CPU Type from qemu that matches your physical one and try that one out.
 
  • Like
Reactions: jeanray
I too have noticed this issue. I’ve tried with mitigations=off on boot and did not find a major difference, cpu=host still performs poorly compared to the generic x86-64-v# models.
 
In my case a simulated CPU performed faster than the Host!

I've had a couple of months painfully working on a molases-level sluggish Windows 10 VM. I've tried every setting and tweak I could think of.

Weirdly enough, as I changed the CPU from Host to x86-64-v3 or even kvm64, I got the rocket speed back.

This is very strange, I know. How can a simulated CPU perform faster than the Host? I don't know, but for now I have less risk of a heart attack.

As a background, this VM was installed with a Host CPU on a different server, then migrated to the current one. Of course pre-migration the CPU was set to "default" (kvm64), then back to Host after successful migration (and test run).

So, any idea why this could be the case?
The same issue here! On [host] setting, the performance is terribly embarrassing. When switching to any other CPU (KVM, x86) the efficiency increases several times.

I need a [host] CPU setting due to WSL.
 
Last edited:
In my case a simulated CPU performed faster than the Host!

I've had a couple of months painfully working on a molases-level sluggish Windows 10 VM. I've tried every setting and tweak I could think of.

Weirdly enough, as I changed the CPU from Host to x86-64-v3 or even kvm64, I got the rocket speed back.

This is very strange, I know. How can a simulated CPU perform faster than the Host? I don't know, but for now I have less risk of a heart attack.

As a background, this VM was installed with a Host CPU on a different server, then migrated to the current one. Of course pre-migration the CPU was set to "default" (kvm64), then back to Host after successful migration (and test run).

So, any idea why this could be the case?
I'm also experiencing this issue. Actual Xeon's are older generation E5530 (Nehalem). Crazy!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!