vSphere 4.1 and vSphere 5.x have an algorithm that dynamically calculates the number of recommended vCPUs on a given host depending on the resources available. This prevents over-committing of resources.
Caution: ESX and ESXi 4.1 allow a maximum of 512 vCPUs and 320 virtual machines per host. In ESXi 5.x, this number was increased to 4096 vCPUs and 512 virtual machines per host. Modifying these values above the limit is unsupported and can lead to host crashing.
Increasing the MAXvCPU count using the vSphere CLI
Run this command to see the maximum number of vCPUs that are allowed:
# esxcfg-advcfg -j maxvCPUs
The output looks similar to:
# esxcfg-advcfg -j maxvCPUs
maxvCPUs = number_of_VCPUs
To increase the maximum number of vCPUs to 512, run the command:
# esxcfg-advcfg -k 512 maxvCPUs
If you rerun # esxcfg-advcfg -j maxvCPUs, the output appears similar to:
# esxcfg-advcfg -j maxvCPUs
maxvCPUs = 512
Increasing the MAXvCPU count using the vSphere Client
To increase the maximum number of vCPUs to 512:
- Launch the vSphere Client.
- Click the host.
- Click the Configuration tab, then go to Advanced Settings.
- Go to Vmkernel > Boot > maxVCPUS.
- Modify the parameter to 512.
Note: For ESXi 5.x, the steps to adjusting the maximum number of vCPUs have changed.
To show the current value for maximum vCPUs allowed per core:
- Connect to the ESXi host with an SSH session.
- Run the following command:
esxcli system settings kernel list -o maxVCPUsPerCore
To set a new configured value for maximum vCPUs allowed per core:
- To determine the number of vCPUs per core, take your maximum number of desired cores, divide by the number of physical cores on the host . Then round up to the nearest whole integer. Then set the per-core vCPU parameter.
For example, you want a maximum of 450 vCPUs and have 12 physical cores in the ESXi host. 450 / 12 = 37.5 rounded to 38. Your maximum vCPUs per core should be 38.
- To set the new maximum vCPUs per core parameter, run the following command:
esxcli system settings kernel set -s maxVCPUsPerCore -v yourMaxPerCore
Where yourMaxPerCore is the number determined in Step 1.
- Reboot the ESXi host and check the parameter using this command:
esxcli system settings kernel list -o maxVCPUsPerCore