This problem is often encountered in server virtualization or virtual desktop projects. When the VM is a high-load business and has high requirements on CPU, we want to allocate more CPU resources to these virtual desktops, but we also find that some systems have a limit on the number of CPU resources supported. Even if the number of CPU resources exceeds the limit, they cannot be used even if they are allocated. Some software charges fees based on the number of CPUs (number of sockets), so you also need to adjust the CPU to reduce the cost.
First, there are several concepts in CPU: Socket, Core, Hyper-Threading (HT ). First, you must understand these.
Socket: wikipedia refers to a CPU connected to the motherboard, which is generally a physical CPU.
Core: wikipedia explains multiple cores integrated on the same CPU chip, that is, the so-called multi-Core
Hyer-Threading: the interpretation of wikipedia simulates multiple threads. Generally, two CPU execution threads are created on a core to Improve the Performance of multiple tasks.
After understanding this, let's talk about the restrictions on the CPU support of the system itself.
The operating system supports both Socket and Core CPUs, hyper-Threading is basically invisible to the operating system (in fact, you can know that Hyper-Threading is enabled through CPU parameters and other mechanisms). Therefore, HT can be simply understood as a core.
The physical CPU (socket) and multi-Core CPU (multi-Core) supported by windows 2003 and other server operating systems are limited by the product version (standard, enterprise, data center version, etc, I will not list them in detail. This article focuses on windows 7 and XP. (For virtual desktop users)
Multi-socket ):
Windows 7 and XP support a maximum of two CPUs, two CPUs for the Enterprise Edition or above, and one CPU for the Enterprise Edition or lower (Home Edition)
Multi-core ):
Windows 7 32-bit system supports a maximum of 32 cores, 64-bit windows 7 supports a CPU of up to 256 cores.
The vCPU allocated by XenServer to virtual machines is presented to the upper-layer virtual machines in the form of Socket. As a result, a maximum of two vcpus can be allocated to the virtual machine through XenCenter, even if multiple vcpus are allocated, the system cannot recognize it either, because windows 7 and XP support up to two sockets.
Windows 7 and XP support multiple cores, so if we can use each socket to have multiple cores and then allocate them to the VM, in this way, more CPU resources can be allocated to these VM systems. For example, if each socket has four cores, we can allocate two 4-core bows and eight vcpus to the VM.
To make such adjustments, we need to manually adjust the Platform Mode settings of the Virtual Machine CPU in XenServer.
# Find the UUID of the template or VM
Xe vm-list
# Or
Xe template-list
# Set the Platform parameter of the template or VM and cores-per-socket
Xe vm-params-set Platform: cores-per-socket = <some count> uuid = <target vm uuid>
# Or
Xe template-params-set Platform: cores-per-socket = <some count> uuid = <target template uuid>
In this way, we can allocate the CPU in the way of multiple cores per socket. We recommend that you modify the VM template to reduce the workload.
BTW: If cores-per-socket is set to 4, if a vCPU is allocated to the VM, It is a socket. If three vcpus are allocated to the VM, since no more than 4, it still appears in the VM in the form of one socket3 core. If there are five, one socket is the core, and the other socket is allocated to the VM as the four core, if eight vcpus are allocated, the VM will see two sockets, each of which has four cores. Other calculation methods are in turn. Therefore, directly modifying the template is safe and easy, but whether it will bring performance overhead remains to be confirmed by other materials.
This article is from "Virtualization"