To improve the virtual machine performance, you can add, change, or configure CPU resources.
Enable CPU Hot Add
By default, you cannot add CPU resources to a virtual machine when the virtual machine is powered on. The CPU hot add option lets you add CPU resources to a running virtual machine.
The following conditions apply.
- For best results, use virtual machines that are compatible with ESXi 5.0 or later.
- Hot adding multicore virtual CPUs is supported only with virtual machines that are compatible with ESXi 5.0 or later.
- If a virtual machine has 128 virtual CPUs or less, you cannot use hot adding to further increase the number of virtual CPUs to be over 128. To change the number of virtual CPUs beyond that limit, you must first power off the virtual machine. By contrast, if a virtual machine already has more than 128 virtual CPUs, you can use hot adding to further increase the number of virtual CPUs to up to 768.
- Not all guest operating systems support CPU hot add. You can deactivate these settings if the guest operating system is not supported.
- To use the CPU hot add feature with virtual machines that are compatible with ESXi 4.x and later, set the Number of cores per socket to 1.
- Adding CPU resources to a running virtual machine with CPU hot add enabled disconnects and reconnects all USB passthrough devices that are connected to that virtual machine.
Prerequisites
- Verify that the virtual machine is configured as follows.
- Latest version of VMware Tools installed.
- Guest operating system that supports CPU hot add.
- Virtual machine compatibility is ESX/ESXi 4.x or later.
- Virtual machine is powered off.
- Required privileges:
Procedure
- Right-click a virtual machine in the inventory and select Edit Settings.
- On the Virtual Hardware tab, expand CPU, and select Enable CPU Hot Add.
- Click OK.
Results
Change the Number of Virtual CPUs
A virtual machine with ESXi 7.0 Update 1 and later compatibility can have up to 768 virtual CPUs. You can change the number of virtual CPUs while your virtual machine is powered off. If virtual CPU hot add is enabled, you can increase the number of virtual CPUs while the virtual machine is running.
Virtual CPU hot add is supported for virtual machines with multicore CPU support and ESXi 5.0 and later compatibility. When the virtual machine is powered on and CPU hot add is enabled, you can hot add virtual CPUs to the running virtual machine. You can add only multiples of the number of cores per socket.
If a virtual machine has 128 virtual CPUs or less, you cannot use hot adding to further increase the number of virtual CPUs. To change the number of virtual CPUs beyond that limit, you must first power off the virtual machine. By contrast, if a virtual machine already has more than 128 virtual CPUs, you can use hot adding to further increase the number of virtual CPUs to up to 768.
The maximum number of virtual CPU sockets that a virtual machine can have is 128. If you want to configure a virtual machine with more than 128 virtual CPUs, you must use multicore virtual CPUs.
Prerequisites
- If CPU hot add is not enabled, power off the virtual machine before adding virtual CPUs.
- To hot add multicore CPUs, verify that the virtual machine is compatible with ESXi 5.0 and later.
- Verify that you have the privilege.
Procedure
Expose VMware Hardware Assisted Virtualization
You can expose full CPU virtualization to the guest operating system so that applications that require hardware virtualization can run on virtual machines without binary translation or paravirtualization.
Prerequisites
For more information, see the VMware KB article at https://kb.vmware.com/s/article/2009916.
- Verify that the virtual machine compatibility is ESXi 5.1 and later.
- Intel Nehalem Generation (Xeon Core i7) or later processors or AMD Opteron Generation 3 (Greyhound) or later processors.
- Verify that Intel VT-x or AMD-V is enabled in the BIOS so that hardware assisted virtualization is possible.
- Required Privileges: set on the vCenter Server system.
Procedure
Activate Virtual CPU Performance Counters
You can use performance tuning tools in the guest operating system for software profiling. You can identify and improve processor performance problems. This capability is useful for software developers who optimize or debug software that runs in the virtual machine.
- If virtual CPU performance counters are enabled, you can migrate the virtual machine only to hosts that have compatible CPU performance counters.
- If an ESXi host's BIOS uses a performance counter or if Fault Tolerance is enabled, some virtual performance counters might not be available for the virtual machine to use.
Prerequisites
- Verify that the virtual machine compatibility is ESXi 5.1 and later.
- Verify that the virtual machine is turned off.
- Verify that Intel Nehalem Generation (Xeon Core i7) or later processors or AMD Opteron Generation 3 ("Greyhound") or later processors are installed.
- Verify that Intel VT-x or AMD-V is enabled in the BIOS so that hardware-assisted virtualization is possible.
- Required Privileges: vCenter Server system. is set on the
Procedure
- Right-click a virtual machine in the inventory and select Edit Settings.
- On the Virtual Hardware tab, expand CPU and select the Enable virtualized CPU performance counters check-box.
- Click OK.
Configure Processor Scheduling Affinity
The Scheduling Affinity option gives you detailed control over how virtual machine CPUs are distributed across the host's physical cores. The option supports hyperthreading if hyperthreading is enabled. ESXi generally manages processor scheduling well, even when hyperthreading is enabled. These settings are useful only for fine-tuning critical virtual machines.
Using CPU affinity, you can assign a virtual machine to a specific processor. This assignment allows you to restrict the assignment of virtual machines to a specific available processor in multiprocessor systems.
This setting does not appear for virtual machines in a DRS cluster or when the host has only one processor core and no hyperthreading.
For potential issues with CPU affinity, see the vSphere Resource Management documentation.
Prerequisites
- Verify that the virtual machine is turned off.
- Verify that the virtual machine does not reside in a DRS cluster.
- Verify that the host has more than one physical processor core.
- Privileges:
Procedure
Activate IO/MMU Virtualization Settings
ESXi can determine whether a virtual machine needs hardware support for virtualization. ESXi makes this determination based on the processor type and the virtual machine. Overriding the automatic selection can provide better performance for some use cases.
You can use software MMU when your virtual machine runs heavy workloads, such as Translation Lookaside Buffers (TLBs) intensive workloads that have significant impact on the overall system performance. However, software MMU has a higher overhead memory requirement than hardware MMU. So, to support software MMU, the maximum overhead supported for virtual machine limit in the VMkernel must be increased.