I came across this useful article from VMware regarding the best practices of configuring vCPU, while keeping an eye on the physical CPU(s) and NUMA nodes available in the physical host.
What is NUMA:
NUMA stands for Non-Uniform Memory Access. To keep it simple, NUMA regulates the relationship between a guest operating system, and the physical resources of the server when it comes to memory consumption. For example, let’s assume that an ESXi host is equipped with two CPU sockets, and 128GB of RAM, and a hosted virtual machine on that host is given 1 CPU, and 64GB of RAM. This physical has two NUMA nodes, as each physical CPU owns 64GB (128GB / 2 = 64GB per physical CPU), so, each NUMA node contains one CPU, and 64GB of RAM, okay?,, then, the hosted VM will be operating with a single virtual NUMA (vNUMA), and the VM gets the best performance out of the physical resources in this case.
In another example, let’s assume that the same VM is configured with a single CPU, and 96GB of memory, in that case, the CPU will require “borrowing” memory from a neighbor CPU to supplement the required memory by the VM (refer to figure: Example 2).
Points ti be considered when configuring vCPU for a VM:
- While there are many advanced vNUMA settings, only in rare cases do they need to be changed from defaults.
- Always configure the virtual machine vCPU count to be reflected as Cores per Socket, until you exceed the physical core count of a single physical NUMA node OR until you exceed the total memory available on a single physical NUMA node.
- When you need to configure more vCPUs than there are physical cores in the NUMA node, OR if you assign more memory than a NUMA node contains, evenly divide the vCPU count across the minimum number of NUMA nodes.
- Don’t assign an odd number of vCPUs when the size of your virtual machine, measured by vCPU count or configured memory, exceeds a physical NUMA node.
- Don’t enable vCPU Hot Add unless you’re okay with vNUMA being disabled.
- Don’t create a VM larger than the total number of physical cores of your host.
Example 1:
Example 2:
References:
What is NUMA?
https://itnext.io/vmware-vsphere-why-checking-numa-configuration-is-so-important-9764c16a7e73
Please go through the article to learn more about VM vCPU config best practices:https://blogs.vmware.com/performance/2017/03/virtual-machine-vcpu-and-vnuma-rightsizing-rules-of-thumb.html