Could use someone help with cpu assignments for virtual machines

slpwrp

Cadet
Joined
Oct 29, 2021
Messages
1
Hi all. I'm getting my feet wet with TrueNAS Core. I put a machine together solely for running 3 Windows vm's. Can you give me a little guidance on assigning cpu resources for maximum performance of the vm's?

CPU: Xeon E3-1225 (6M Cache, 3.10 GHz) (4 cores, 4 threads)

3 VM's each configured for:
- Virtual CPU's: 2, cores: 1, threads: 1

RAM total is 48GB - I left 18GB for the TrueNAS system.

Sound right? All wrong? Thank you.
 

Morris

Contributor
Joined
Nov 21, 2020
Messages
120
Maximum performance of the VMs in what way? The application and the disks will be important. If the applications on the VMs need CPU, you could allocate each as Virtual CPU's: 1, cores: 8, threads: 1.
or
Virtual CPU's: 1, cores: 4, threads: 4
Those two configurations are identical as both yield 8 VCPUs
If your windows licenses support multiple CPUs, then you could also get the same with:
CPU's: 2, cores: 2, threads: 2
and other combinations that add up to 8 VCPUs. There all the same

Morris
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
Hyperthreading (virtual CPUs) cuts the entire CPU in half : registries, cache, ... When you have any single thread process, to run it on such a virtual CPU will cut its performance drastically. In the same way, when you have many different and small thread, disabling hyper threading will cut your performance. As such, you need to know more about the exact processes you will run.

Also, more is not necessarily better. An hypervisor will run a bit of a VM for a little while then move to another. Between such rounds, a VM ends up "sleeping" for a few clock cycles. The thing is, that VM can not come back online and running until ALL its CPUs are available. Should you have a VM with 4 CPUs and only 2 are available, the hypervisor will wait until it can free 2 more CPU and only then it will resume working that VM. Under ESXi, this is called "CPU Ready" and is basically wasted time. Of course, the more you waste, the less performant you are. So should you need only 2 CPUs and give 4, you will actually slow down your VM by increasing its CPU Ready mark while not gaining anything because only 2 where enough.

So "The Best Performance" is far to be an absolute or achievable with a silver bullet...
 
Top