Time for another short! The google searches leading to this blog show searches coming in based on the cpuid.corespersocket setting. In this short I’ll try to explain what this setting is for and how it behaves. So, let’s dig right in!
The cpuid.corespersocket setting
In a sense, you would assume that the name of the setting says it all. And in a sense, it does. In the physical world, you will have a number of sockets on your motherboard, this number of sockets is normally also the number of physical CPU’s that you have on said motherboard (at least in an ideal world), and each CPU will have one or more cores on it.
Wikipedia describes this in the following way:
One can describe it as an integrated circuit to which two or more individual processors (called cores in this sense) have been attached.
…..
The amount of performance gained by the use of a multi-core processor depends very much on the software algorithms and implementation. In particular, the possible gains are limited by the fraction of the software that can be parallelized to run on multiple cores simultaneously; this effect is described by Amdahl’s law. In the best case, so-called embarrassingly parallel problems may realize speedup factors near the number of cores, or beyond even that if the problem is split up enough to fit within each processor’s or core’s cache(s) due to the fact that the much slower main memory system is avoided.
Now, this sounds quite good, but some of you may ask what kind of influence this has on my virtualized systems. The most obvious answer would be “none at all”. This is because by default your virtualized system will see the cores as physical CPU’s and be done with it.
So, now you are probably wondering why VMware would even distinguish between cores and sockets. The answer is quite simple; It’s due to licensing. Not so much by VMware, but by the software or operating system that you would like to virtualize. You see, some of that software is licensed per core, and some will license by the number of sockets (some even combine the two).
So how do I use it?
As with all things computer related… It depends. When you are using ESX 3.5 you have no chance of using it. With ESX 4, you can actually use this feature, but it is not officially supported (someone please point me in the right direction if this is incorrect). And starting with ESX 4.1 the setting is now officially supported, and even documented in the VMware Knowledge Base as KB Article: 1010184.
Simply put, you can now create a virtual machine with for example 4 vCPU’s and set the cpuid.corespersocket to 2. This will make your operating system assume that you have two CPU’s, and that each CPU has two cores. If you create a machine with 8 vCPU’s and again select a cpuid.corespersocket of 2, your operating system will report 4 dual-core CPU’s.
You can actually set this value by either going this route:
- Power off the virtual machine.
- Right-click on the virtual machine and click Edit Settings.
- Click Hardware and select CPUs.
- Choose the number of virtual processors.
- Click the Options tab.
- Click General, in the Advanced options section.
- Click Configuration Parameters.
- Include cpuid.coresPerSocket in the Name column.
- Enter a value ( try 2, 4, or 8 ) in the Value column.
Note: This must hold:
#VCPUs for the VM / cpuid.coresPerSocket = An integer
That is, the number of vCPUs must be divisible by cpuid.coresPerSocket. So if your virtual machine is created with 8 vCPUs, coresPerSocket can only be 1, 2, 4, or 8.
The virtual machine now appears to the operating system as having multi-core CPUs with the number of cores per CPU given by the value that you provided in step 9.
- Click OK.
- Power on the virtual machine.
If the setting isn’t shown, for example for those who want to experiment with it under ESX 4.0, you can create the values in the following way:
- Power off the virtual machine.
- Right-click on the virtual machine and click Edit Settings.
- Click the Options tab.
- Click General, under the Advanced options section.
- Click Configuration Parameters.
- Click Add Row.
- Enter “cpuid.coresPerSocket” in the Name column.
- Enter a value ( try 2, 4, or 8 ) in the Value column.
- Click OK.
- Power on the virtual machine.
To check if your settings actually worked, you can use the sysinternals tool called Coreinfo on your Windows systems, and on Linux you can perform a simple “cat /proc/cpuinfo” to see if everything works.