Let’s talk a little bit about VM CPU reservations. I recently had a question about reserving X number of CPU’s for a VM, which was required for a vendor specific virtual machine for some software that was being installed on a server.
So, what exactly is a CPU reservation? To put it simply, a reservation is the guaranteed minimum resource allocation for a virtual machine. In this case the resource is CPU, defined in clock cycles and reserved in Ghz or Mhz. The default CPU reservation value on a VM is 0 (zero).
Note: reservations, limits, and shares can be set on the individual VM, or alternatively, in a resource pool, depending on the configuration needed. For this particular example, we’ll focus on CPU reservation on the VM.
To achieve setting the reservation the solution is a little like a math problem.
For example, I want to set a x2 CPU reservation for a Linux VM in my cluster.
First, find the total CPU capacity for your host. Hold up…how do I find the total CPU capacity of my host?
Simple…you can find this info on the Host summary page in vCenter, on the right panel. This will show CPU capacity, free and used (RAM and storage too)
Alternatively, you can calculate it:
4 processor cores per socket (green) x the 3.59Ghz processor speed (orange) = 14.36Ghz available (in vCenter, Host -> Configure -> Hardware -> Overview)
If I do the math, 14.36Ghz divided by 4 number of cores gives me 3.59Ghz max per core, which makes sense since I have 4 cores and a total capacity of 14.36Ghz. Multiply that per core value time times the number of cores required, and that’s my reservation value. So, if I want to reserve 2 CPU’s, the reservation value would be 3.59Ghz x 2 = 7.18Ghz.
And with that known, let’s go ahead and set the CPU reservation. In vCenter (or the Host client) right-click on the VM and select Edit Settings. Click the carat to expand out the CPU settings section, and you’ll see some additional options like below
Input the value for the CPU reservation: 7.18 Ghz (or 7189Mhz)
Notice that after setting the reservation and going back into the VM settings, vCenter went ahead and reported the reservation in MHz and also rounded up
And click OK to save settings. And that’s it, my VM CPU reservation is set.
Pro tip: remember that the total of all CPU reservations for all VMs on a host cannot be more than 90% of the host capacity, because 10% is reserved by the host for its own functions and processing.
Next up, I’ll post more information on CPU limits and shares, so be on the lookout for those blogs.
Check out the links below for more information and reference, and cheers!
Sources and links:
Resource Allocation Reservation (vmware.com)
Leave a Reply