CPU Calculation for Virtual Machine in Hyper-V and ESXi
There is much confusion about creating number of Virtual machines on a single host, keeping memory and storage unlimited. In-order to clarify , I would say ,Yes we do have limitation in creating VMs and its explained below in brief.
If you are using Windows Hyper-V for virtualization, so the number of VMs is dependent on the number of Virtual CPU available. We can have a multiple formula based on the scenario however the best on the basis of my personal experience I can put it in as
Total vCPU = (Number of processors) * (Number of cores) * (Number of threads per core) * 8Number of Processor: In desktop environment we usually uses one physical processor however in server environment it exceeds the number.Number of Cores: Usually now a days 2 core, 4 core, 6 core, 8 core and even 12 core and 16 core processors are also available.Number of threads per core: if hyper-threading is supported and enabled through BIOS, you can consider the number as 2 else 1.
If you need to get into the details you can also follow the below mentioned link:-
So if you have 1 dual core physical processor with hyper threading enable ,then based on the formula you have Total vCPU = 1 (Physical processor) x 2 (dual core) x 2 (hyperthreading) x 8 = 32 vCPU
Since you have 32vCPU so you can create 32 VM with 1 vCPU each or 8VM with 4 vCPU each.
The maximum number of vCPU you can assign to a virtual machine in Hyper-V is 4.
Where as in VMWare , ESXi host enabled for hyper-threading should behave similarly to a host without hyper-threading . So the number of CPU allocation is not restricted or dependent on the basis of hyper-threading enabled or disabled.
In ESXi you doesn’t calculated based on vCPU available however it is totally dependent on the processing capacity. As you can restrict the usage of CPU capacity. So processing capacity can be calculated as :-
Total Processing Capacity = Processing capacity, rated on processor * No. Of Physical Socket * No. of Cores per socketFor example :-If we have 2 physical processor of 2.599GHz capacity and each processor has 6 Cores then as per formula,Total Processing Capacity = [2.599 (Processor rating)*2(physical processor)*6(cores per processor) ]GHz = 31.188GHz
Since we are now aware of the total processing capacity, so we can create a virtual machine by allocating a CPU and restricting its maximum CPU utilization to be 512 MHz ,the number of VM so similar configuration can be upto 609 VMs or you can create 12 VMs of 2.599GHz capacity its scalable or you can calculate based on your requirement or even if you wish you can leave its default configuration and VMWare will smartly manage the CPU utilization of all the CPU processing capacity ,only condition is that all the VMs collectively must not exceed the processing capacity at the same time which may result in bottleneck causing latency or slowness.