0

At least in VMware when creating or tweaking the settings of a VM I choose how many CPU cores I let the VM use. This question came to mind when thinking about at some point potentially running multiple VMs at once. Is there a limit to how many VMs I can run based off of how many CPU cores are allocated to other VMs or my main system? For example I have 6 cores, would I only be able to run 5 VMs; each one using 5 cores leaving one for my system? Or can I run more than 5 VMs and they'll just share cores at an obvious cost to performance?

1
  • You can overprovision your CPU allowing you to assign more vCPUs than you have. Too much though and you'll see a noticeable performance hit on the host and VMs. However, you'll generally run out of RAM or have disk IO issues well before your CPU is overtaxed.
    – essjae
    Nov 17 '20 at 17:38
1

If you're using vSphere (which I assume you are as you tagged vmware, when you allocate 1 CPU core you're allocating 1 vCPU core. The CPU does not bind to a physical CPU core (pCPU).

For vSphere 6.0, there is a maximum of 32 vCPUs per physical core, and vSphere administrators can allocate up to 4,096 vCPUs to virtual machines on a single host, although the actual achievable number of vCPUs per core depends on the workload and specifics of the hardware.

For every workload beyond a 1:1 vCPU to pCPU ratio to get processor time, the vSphere hypervisor must invoke processor scheduling to distribute processor time to virtual machines that need it. Therefore, if the vSphere administrator has created a 5:1 vCPU to pCPU ratio, each processor is supporting five vCPUs. The higher the ratio becomes, the higher the performance impact will be, because you have to account for the length of time that a virtual machine has to wait for physical processors to become available. The metric that is by far the most useful when looking at CPU oversubscription, and when determining how long virtual machines have to wait for processor time, is CPU Ready.

The vCPU-to-pCPU ratio to aim to achieve in your design depends upon the application you are virtualizing. In the absence of any empirical data, which is generally the case on a heterogeneous cloud platform, it is a good practice, through the use of templates and blueprints, to encourage your service consumers to start with a single vCPU and scale out when it is necessary. While multiple vCPUs are great for workloads that support parallelization, this is counterproductive in the case for applications that do not have built in multi-threaded structures. Therefore, while a virtual machine with 4 vCPUs will require the hypervisor to wait for 4 pCPUs to become available, on a particularly busy ESXi host with other virtual machines, this could take significantly longer than if the VM in question only had a single vCPU. This performance impact is further extended as the vSphere ESXi scheduling mechanism prefers to use the same vCPU-to-pCPU mapping to boost performance through CPU caching on the socket.

https://www.vmware.com/pdf/Perf_Best_Practices_vSphere5.5.pdf

You can also search for 'virtual machine cpu overcommit' for more results.

1

I find a good rule of thumb if using VMware Workstation is 1 CPU with two cores. This works well for Windows Guests and Linux Guests.

You are not limited by the number of cores you have as to the number of machines. My laptop has 4 cores and I run a Windows 10 Host with 3 guests: Windows 7, Kali, and Ubuntu.

I assign 3 GB of memory to each machine and have 16GB of memory total.

The biggest performance boost I get is from a very fast NVMe SSD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.