Socket or Multiple Core Assignment in Virtual Machine:
There is always confusion in student’s mind while assigning number of socket vs number of cores to VM during Virtual Machine Creation.
Surprisingly most of the students didn’t even notice this option while assigning vCPUs to VM? Few had doubt about does it really matter assigning more no of cores instead of more no of sockets to VM? Does Socket or Core configuration does make any difference in VM performance?
In this article, I’ll try my best to answer all your queries & your feedback will be really appreciable.
Before Digging directly into VMware Implementation about virtual sockets or core. Let’s clear the basics first about Socket vs Core.
What Is Core?
Physical core within a Physical Processor which actually performs computational work or code execution. Its a complete private set of
registers, execution units and queues required to execute programs.
Earlier days, we used to have 1 core per socket which means single processing unit to perform all computational tasks.
1 Socket = 1 Core = 1 Physical CPU
Drawbacks of Single Socket Core Processor
Single Socket Core configuration doesn’t work well in multi-threaded environment and all multi thread gets executed in sequential manner due to 1 Core available on physical processor.
As a result, System becomes slower.
Evolution of Multiple Core Processor to Support Multithreaded Environment
To support multi threaded environment & increasing system performance, CPU manufacturers added additional “cores,” or central processing units on single physical processor. For ex. A quad-core CPU will have four central processing units so called “cores” on single chip.
These four cores will appear as 4 CPUs to operating system and multi-threaded applications can be scheduled simultaneously on these 4 Cores by operating system. As a result,different processes will be running on each core at the same time. This speeds up system performance and gives us multitasking executional environment.
1 Socket = Multiple Cores = Multiple Processing Units
Socket Limitations of General Purpose Operating System
Few of the Operating systems are hard limited to run on a fixed number of CPUs. Operating systems vendors restricts to use limited no of physical CPUs even though more Physical CPUs are available due to socket limitations of Operating system.
For example: Windows server 2003 standard edition is limited to run on upto 4 cpus. If we install this operating system on 8 socket Physical box, it will run only on 4 of the CPUs.
But the catch here is these OS vendor restricts the number of physical CPU ( sockets) and not the number of Logical CPU ( known as Cores).
How Socket Limitation Issue got resolved by CPU vendors
Industry vendor started adding more cores to single socket & operating system took advantage of multi-core CPUs. For ex: Now, if we install Windows Server 2003 standard edition on quad core dual socket processor system. (2 Socket * 4 core) = 8 Physical CPUs.
Operating system will be able scheduled instructions on all the 8 Physical CPUs because sockets still being used 2 but now no of cores had been increased per socket to avoid OS Socket Limitations.
For ex: If any general purpose OS has limitation of 2 socket, but application requires to use 8 PCPUs.
Now with multi-core implementation, we could expose 8 PCPUs to application using 2 socket * quad-core system.
2 Socket * 4 Core = 8 PCPUs.
I hope now you would have understood what is OS socket limitations and how it was overcome in physical world.
How VMware Addressed Socket Limitation Issues at Virtual Machine Guest OS level
Prior to vSphere 4.1, there were no specific options called socket or core for vCPU assignment to VM.The only option which was available was “No of logical processors” which internally translates to no of sockets.
Prior to 4.1, by default VMkernel used to create 1 core per socket for each vCPU assigned to Guest OS.
For ex: An vSphere admin needs to create VM with 4 vCPU, he used to specify “no of logical processor -> 4”. VMkernel used to create 4 Virtual Sockets & each Virtual Socket will have 1 core assigned to it.
Below is example of vCPU assignment to Guest OS prior to ESXi4.1
16 vCPU -> 16 Socket * 1 Core
10 vCPU -> 10 Socket * 1 Core
8 vCPU -> 8 Socket * 1 Core
6 vCPU -> 6 Socket * 1 Core
VMware implementation of assigning 1 socket for each core restricts few Operating system vendors to use limited no of physical CPUs even though vCPUs are more due to socket limitations of Operating system.
Like Physical Environment, VMware also implemented multi Cores per socket to overcome Guest OS socket limitations. Now Virtual Machine running win2003 standard edition configured with 1 Virtual Socket and 8 Cores per socket allows operating system to utilize all the 8 vCPUs.
Just to show you guys how it works, I initially configured VM with 8 vCPUs and each core presented as single Socket
When reviewing the CPU configuration inside the guest OS, the task manager shows 4 vCPUs.
Reconfigured the machine with 8 vCPUs containing 1 Socket and 8 cores per Socket
After powering on the virtual machine, Guest OS sees 8 vCPUs.
Does MultipleCoresperSocket affects Virtual Machine Performance?
Now we could understand that how Guest OS socket limitations overcome by assigning more cores to virtual Sockets in VMware world. But still questions remains the same. Does it make any impact on Virtual Machine Performance to use more sockets vs more cores?
In brief, The Answer is NO.
There is no performance impact between using Virtual Sockets or Virtual Cores while assigning vCPUs to Virtual Machine. But Above statement is only true as long as the total size of Virtual Machine does not exceed Physical NUMA Node.
However as soon as vNUMA used, core per socket can have a real impact.
Why Virtual Socket and Virtual Core doesn’t have real impact on Virtual Machines? Why vNUMA impact Virtual Machine Socket configuration but pNUMA doesn’t? I’ll be covering all the details about pNUMA and vNUMA in my upcoming articles.
I hope this article will help you to understand socket vs core configuration done during vCPU assignment to any Virtual Machine.
Please don’t forget to share your comments and rating for this article.
Be Sociable – Keep Sharing, Keep Learning!!