Vmware Slot Size Calculation
I’ve been receiving a lot of questions around slot sizes lately. Although I point everyone to my HA Deepdive post not everyone seems to understand what I am trying to explain. The foremost reason is that most people need to be able to visualize it; which is tough with slot sizes. Just to freshen up an outtake from the article:
HA uses the highest CPU reservation of any given VM and the highest memory reservation of any given VM. If there is no reservation a default of 256Mhz will be used for the CPU slot and the memory overhead will be used for the memory slot!
As stated earlier, you can also use esxtop to help you calculate a host’s available CPU and memory resources. For example, pressing ‘c’ lets you view CPU performance information: # esxtop 9:24:41am up 7:20, 290 worlds, 0 VMs, 0 vCPUs; CPU load average: 0.01, 0.00 PCPU USED(%): 2.2 1.8 1.0 1.0 AVG: 1.5 PCPU UTIL(%): 2.7 2.5 2.0 1.4 AVG: 2.2. Learn what a slot is, how it is calculated, and how it affects your vSphere HA Admission Control.
If VM1 has 2GHZ and 1024GB reserved and VM2 has 1GHZ and 2048GB reserved the slot size for memory will be 2048MB+memory overhead and the slot size for CPU will be 2GHZ.
Now how does HA calculate how many slots are available per host?
Vmware Slot Size Calculation Chart
Vmware Slot Size Calculation
Of course we need to know what the slot size for memory and CPU is first. Then we divide the total available CPU resources of a host by the CPU slot size and the total available Memory Resources of a host by the memory slot size. This leaves us with a slot size for both memory and CPU. The most restrictive number is the amount of slots for this host. If you have 25 CPU slots but only 5 memory slots the amount of available slots for this host will be 5.
The first question I got was around unbalanced clusters. Unbalanced would for instance be a cluster with 5 hosts of which one contains substantially more memory than the others. What would happen to the total amount of slots in a cluster of the following specs:
Five hosts, each host has 16GB of memory except for one host(esx5) which has recently been added and has 32GB of memory. One of the VMs in this cluster has 4CPUs and 4GB of memory, because there are no reservations set the memory overhead of 325MB is being used to calculate the memory slot sizes. (It’s more restrictive than the CPU slot size.)
This results in 50 slots for esx01, esx02, esx03 and esx04. However, esx05 will have 100 slots available. Although this sounds great admission control rules the host out with the most slots as it takes the worst case scenario into account. In other words; end result: 200 slot cluster.
With 5 hosts of 16GB, (5 x 50) – (1 x 50), the result would have been exactly the same. To make a long story short: balance your clusters when using admission control!
Vmware Slot Size Calculation Tool
The second question I received this week was around limiting the slotsizes with the advanced options das.slotCpuInMHz and/or das.slotMemInMB. If you need to use a high reservation for either CPU or Memory these options could definitely be useful, there is however something that you need to know. Check this diagram and see if you spot the problem, the das.slotMemInMB has been set to 1024MB.
Notice that the memory slotsize has been set to 1024MB. VM24 has a 4GB reservation set. Because of this VM24 spans 4 slots. As you might have noticed none of the hosts has 4 slots left. Although in total there are enough slots available; they are scattered and HA might not be able to actually boot VM24. Keep in mind that admission control does not take scattering of slots into account. It does count 4 slots for VM24, but it will not verify the amount of available slots per host.
To make sure you will always have enough slots and know what your current situation is Alan Renouf wrote an excellent script. This script reports the following:
Example Output:
Vmware Slot Size Calculation Formula
Cluster : Production
TotalSlots : 32
UsedSlots : 10
AvailableSlots : 22
SlotNumvCPUs : 1
SlotCPUMHz : 256
SlotMemoryMB : 118
Vmware Cluster Slot Size Calculation
Vmware Slot Size Calculation Calculator
My article was a collaboration with Alan and I hope you find both article valuable. We’ve put a lot of time into making things as straight forward and simplistic as we possibly can.