Some vendors license their application per processor, also in a virtualized environment. So if your VM has 4 vCPU’s your vendor will want you to buy a 4 processor license for the application. But you can avoid this by telling the VM that it has cores instead of processors. In others words, instead of having 4 processors you would have 1 processor with 4 cores:
- Power off the VM
- Right click on the VM and select “Edit Settings…”
- Select the “Options” tab
- Click on “General” (in the “Advanced” options section)
- Click “Configuration Parameters…” (in the pane on the right)
- 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 VM
The VM will now appear to the OS as having multi-core CPUs with the number of cores per CPU given by the value that you selected. For example, if you create an 8 VCPU VM and set “cpuid.coresPerSocket = 2” it will be recognized as 4 dual-core CPU’s by the OS while it’s actually utilizing 8 physical cores.
Keep in mind that this feature is currently unsupported!
Duncan,
I had success with this in the beta, but upon attempting it with the GA, I didn’t see any difference between 2 vCPUs or 1 dual core vCPU in Windows 2003.
Also, remember that this may very well put you in illegal waters. Always make sure to check with the vendor if what you intend to do is actually what they licensed you to do.
Hyper-V does this automatically, btw. If you have a 4 CPU VM, and the host is running 4 dualcore CPU, the VM will see two dualcore CPUs. If the host is running 4 quadcore CPUs, the VM will see a single quad core CPU.
Wow, that would be so cool. We run SQL Server in a number of VMs, and SQL is licensed per-socket. So we could save a huge amount of money on SQL licensing alone!
Does this trick only work on vSphere 4, or can we use it with ESX 3.5u4?
I just implemented it in ESX 3.5u2.
@Lukas
I am not certain why you would FUD by saying it could put you in “illegal waters.”
It would certainly seem reasonable that if I have 4x Dualcore processors in the physical system and I have a 2x vCPU VM that I would rather it show as a single socket Dualcore and would certainly be legal. Same as the example you give from Microsoft’s Hyper-V.
I could understand your concern if someone was trying to run a 8x vCPU VM on 4x Dualcore as cpuid.coresPerSocket 4.
However, I would be concerned at that point about performance as I assume you would be limiting Scheduler to run across 2 of your Dualcore processors for each time slice.
Great information Duncan.
Oh Duncan you are so evil, the lawyers are hot on your trail now. š Love this post, it’s one for the 3 ring binder. Thanks!
Little unrelated to the post, but is there an list for available “Configuration Parameters” that can be used?
Lukas, if a vendor doesn’t agree send them to me and I will welcome them into 2009. š
If you run SQL Server Enterprise, you only need license it for the underlying CPUs, and you can then run unlimited instances of SQL Server. With a 2-CPU Intel 5500 based server, you should be able to run lots of SQL Server so this can potentialy provide a quick payback.
Surely this could undermine the VMWare limitation of 8vCPU included with Enterprise Plus edition of vSphere?
@roidude, actually you have to license based on vCPUs assigned to each VM.
When you assign 2, 4 or even 8 vCPUs currently they will be presented to the guest as distinct sockets.
With the change Duncan has identified, you can present your underlying hardware of multiple cores per socket to the VM and properly license your SQL instance.
@kiddkoala, how so? This would simply allow you to properly present your underlying hardware up to a new maximum of 8 vCPUs. Sounds perfect to me. This doesn’t change how many vCPUs can be presented to a guest, just HOW they are presented.
indeed, it doesn’t limit scheduling or the amount of vCPU’s just how the GOS sees these.
Duncan,
Have you received any confirmation of support on this? I have submitted it through our Rep as well and have not received any information.
Thank you.
Experimental support only at the moment.
Apologies for my previous comment, I have reread and now fully understand – it will not undermine the licensing at all.
Thank you! I migrated a SQL server to ESXi a while back and had to move from a single-socket, quad-core to a single vCPU because I couldn’t get the OS to detect a second vCPU as a second core and not a separate socket.
Aside from making it easier/cheaper to license per applications per socket, what other uses does this have?
This is fantastic for VDI deployments. Windows XP has a 2 socket limit, so normally that would be 2 virtual cpu’s. But if I buy a high power desktop I can install 2 quad core processors giving me 8 cpu’s. Now I can do this on a VM running XP too! Awesome.
Important note to this.
“The number of VCPUs must be divisible by cpuid.coresPerSocket. So if your VM was created with
8 VCPUs, coresPerSocket can only be 1,2,4, or 8.”
I didn’t quite get the process the first time so maybe this will help the next person to come along.
You first have to determine how many cores you need. If you need 8 cores then assign 8 VCPUs to your machine. Then if you set coresPerSocket to 4, ESX will assume you mean 2 Quad core processors. I first made the assumption that I would assign 1 vCPU and then set coresPerSocket to 2 to get 1 dual core CPU and it just doesn’t work that way.
We have some XP machines we use to build/compile our software for that given platform, and have run into the 2 processor limitation already. Can anyone confirm that they have bumped this up to say 4 cores (2 sockets with 2 cores) or 8 cores (2 sockets with 4 cores) successfully? does this have an adverse affect on co-scheduling that is different from a VM/OS that is allowed to have 4 or 8 sockets?
Andrews says:
–
I just implemented it in ESX 3.5u2.
–
Has anyone else done this on esx 3.5 ?
Regards
Anders
For those of us with Microsoft SQL – They have recently clarified their Processsor based licensing. Licensing for SQL is based on the PHYSICAL processor / per VM. Within a VM, if the host has 4 cores per socket, then a single processor license would allow you to present 4 Virtual Processors to the VM. This was first clarified in answer to a question I posed to a Licensing person at MS – see http://ladylicensing.spaces.live.com/blog/cns!87F95F1B5B21B01E!1558.entry?ccr=136#comment . The official licensing page for SQL 2005 has also been updated to make this a bit more clear.
Hope that helps!
Doesn’t seem to address the problem that it only lets me assign 2 vCPU’s to my XP VM. Not sure if changing the OS type is also required before it will let me do that but am going to give it a shot…
Update to previous – doesn’t seem to work on ESX 4.0
This didn’t seem to work for me in ESXi. I’m running windows 2k8R2 standard. Even after adjusting the “cpuid.coresPerSocketā i’m unable to allocate 8vcpu’s. I had 4 to begin with. I shutdown the vm and tried the “cpuid.coresPerSocketā with 2 and 4. Every time I attempt to increase the vcpu’s it tells me that “Virtual machine has 9 vcpu’s but the host only supports 4. The number of vcpu’s may be limited by the guest OS selected for the virtual machine or by the licensing for the host”. I know for a fact that windows 2k8R2 can take advantace of dual core hyperthreaded procs. Any ideas?
Just tried this again and in ESX 4.0 this works fine as per all the other posts – I just needed to do an update hardware on the VM.
CK – you’re restricted by your VMWare licences to 4 vCPUs
If you had Enterprise Plus, you could supply 8 vCPUs – this trick is merely a way of changing the presentation of the processors – as multiple cores in single or more sockets. This is useful to allow a VM to behave the same as a similar physical machine.
Example – we have an app that requires 8vCPUs but W2K3 x64 Std. only supports 4 sockets. If we present them without this tweak we can only use 4 vcpus in the OS. Changing this setting to dual cores per socket means we present 4 sockets, but 8 cores, which is, as the youth say, for the win!
Any news on if this is officially supported in 4.1?
it is officially supported as of 4.1
I tried this with ESXi 4.1 on a CentOS x86_64 Guest i added cpuid.coresPerSocket and then 4 in the value and powered on the VM, It still only recognized (4) Cores. I’m trying to get it up to 8. Any Ideas?
Jared,
Do you have the “enterprise plus” version?
With normal “enterprise” version you will only ever see max 4 processors (or cores).
I have set the value as per the KB Article: 1010184 but my 2003 server still does not report multiple cores using CPU-Z utility to show cores, please help with pointers as to what i am doing wrong.
Since the max. vCPU is 8, does this mean the maximum cores would be 8 (one core to one vcpu)? Or can I use this to get more cores?
For instance I have a 2 socket 6 core server and I want to use the 12 cores in 1 VM, would that work?
Is this parameter addition enabled for the free version of ESXi 4.1? Or perhaps only the paid licensed versions?
I have a W7-64 vm on a Dell R710 with dual quad-core processors. They also have hyper-threading enabled giving me a total of 16 logical processors. I am trying to get my W7 vm to have 4 cpus through whatever means possible. I tried to assign the vm 4 processors, assign the vm 2 processors with 2 cores, and just a single processor with 4 cores through the above method, but cannot seem to do so. My only guess is that this feature is not available for the free version.
Any know this to be the case? Perhaps I’m overlooking something simple? Any help would be appreciated.
I am experiencing the same issue of trying to assign 1 vCPU and 4 cores, but the OS doesn’t recognize the additional cores. Im on ESXi 4.1 here and guest OS is Win2k8R2.
Same thing for me in initial testing. Regardless of how many vCPUs I allocate, the settings change is not reflected in the guest OS.
I too am having trouble. I’d like to set 1 vCPU to have 4 cores, Page 79 of this document: http://www.vmware.com/pdf/vsphere4/r41/vsp_41_vm_admin_guide.pdf leads one to believe that it’s possible.
However, setting 1 vCPU with 4 cores does not work. 1/4=.25 (not an integer) and 4 vCPU with 1 core just shows 4 single core CPU.
2 vCPU + 2 coresPerSocket works, as does 4 vCPU with 4 coresPerSocket. But I can’t get any other combination (2 cpu / 4 core etc) to work.
You just have it backwards. 4 cores in 1 cpu is 4 vCPU’s and 1 cpuid.coresPerSocket (which is the same as never adding the cpuid.coresPerSocket row and setting 4 vCPU’s as far as 32bit XP Pro is concerned and you’ll only see 2 CPUs in the guest). Setting both values to equal each other cancels out and makes the total number match. 4 vCPU’s and 4 cpuid.coresPerSocket still shows in XP Pro as 2 CPUs (at least it did for me), as did them both set to 2. I had to set the vCPU’s to 4 and the cpuid.coresPerSocket to 2.
is measured in megahertz (MHz) or these days in gigahertz (GHz).
A little clarification for those that didn’t get it at first (like me). You want the configured number of processors to be the total amount of cores you want to see. The number of physical sockets becomes a math equation that goes like this:
Number of processors / cpuid.coresPerSocket = sockets.
Kinda makes sense and made me feel stupid for not getting it. Anyway, that means you want your set number of CPUs to be higher than your coresPerSocket. So the max for ESXi without any licensing running Windows XP Pro is 4 cores. So set the CPUs to 4 and the cpuid.coresPerSocket to 2 and voila. You now have 4 processors in the task manager’s performance tab, and finally, a decent running 32bit XP box!
Just applied it on a ESXi 4.1 with Enterprise Plus license with a VM with SBS2011 and it works great.
The problem was the Windows Server 2008 just allow’s 4 sockets. My assigned 8vCpu’s where not used, only 4 of them.
Set “cpuid.coresPerSocket” to 2 and now I have 8 Core’s in Windows 2008 instead of 4.
Has anyone tried to make this change on a Linux VM? I just did it recently and there was a very significant difference in how the guest OS views the change AND the VM performance.
Initial configuration:
– OS Red Hat 5
– VMware Assignment 4 vCPUs (no cpuid.coresPerSocket configuration)
-OS view of /proc/cpuinfo showed 4 processors (no “cpu cores” line)
– time to complete CPU intensive load task 30+ minutes
Updated configuration:
– OS Red Hat 5
– VMware Assignment 4 vCPUs (4 cpuid.coresPerSocket configuration)
-OS view of /proc/cpuinfo showed 4 processors AND a new line for “cpu cores: 4”)
– time to complete identical CPU intensive task 4 minutes
Thx for information.
Duncan , apart from the licensing benefit , is there a real difference ( from performance view ) between a VM with 4vcpu*1vcore and one with 2vcpu*2vcore
thanks