vmware vcpu


What is Vmware vCPU ?

vmware doesn't care how many physical CPU's you have, it'll register the total core count as virtual CPU's. 
vCPU stands for virtual cpu, which is similar to physical cpu in the physical world...it is available in both products....having 3-4 V's per core is a rough estimate, you can support more depending on the VM's type you run.

vCPU is a virtual processor, you can assign multiple (up to 4) vCPUs to a Virtual Machine but you should never exceed the number of physical sockets you have, for example if you have a 2 CPU server you should only assign a maximum of 2 vCPUs to a VM.

 
 
The number of Virtual CPUs you run per core depends on the workload of the VMs and amount of resources you expect to use on your ESX. Therefore VMs running off the server the lower the performance. Its all down to doing your maths before hand and working out what you can safely configure on each ESX.

 
 
4-8 VMs per core is the norm, better to stick closer to 4 if you are looking for performance, and if the maximum number of VMs per ESX is more important with less importance for performance then you can move closer to the sum of 8.


At its most basic level vCPU  stands for Virtual Central Processing Unit and is anologous to the CPU in a traditional physical machine.    the number of vCPUs per core is dependant on load and a hard limit (see the configuration maximums doc for further info)  but 4-6 single vCPU guest per Core is possible this would equate to between 24-32 guests on a dual/Quad core and 48-64 on a Quad/Quad core host.  your milage my vary here as it is load dependant,  that is why a capacity planning exercise is important before embarking on your virtualisation journey.

Taken from: http://communities.vmware.com/docs/DOC-4960:
For a multiprocessor VM (also known as an "SMP VM"), it is important to present the guest OS and applications executing within the VM with the illusion that they are running on a dedicated physical multiprocessor. ESX Server faithfully implements this illusion by supporting near-synchronous co-scheduling of the virtual CPUs within a single multiprocessor VM.

The term "co-scheduling" refers to a technique used in concurrent systems for scheduling related processes to run on different processors at the same time. This approach, alternately referred to as "gang scheduling", had historically been applied to running high-performance parallel applications, such as scientific computations. VMware ESX Server pioneered a form of co-scheduling that is optimized for running SMP VMs efficiently.

Digging into the technicalities of this "co-scheduling" teaches us that:

The nature of the co-scheduling model is that it will only execute if both cores are free at the same time. Therefore, the more cores on a server are used, the more the multi vCPU VM will have to wait for a moment where both cores are available at the same time.

Performance problems do develop when you try to run multi vCPU's and single vCPU VM's on the same hardware.
The recommended way (although no benchmark testing results seem to be available) is to keep 2 vCPU VM's and 1 vCPU VM's separated.

Notes:
No VM should ever be assigned all the cores available on a machine. VMware recommends using a maximum of half of the cores available to the VM, (assigning 2 vCPU's to a VM on 4 core hardware).

 

Firstly, the name vCPU gives it away – its a virtual CPU. You have many more virtual than physical CPU's – when you allocate beyond the number of physical cores, you start to oversubscribe your host. Nothing wrong with this, within limits and reasons.

Secondly, a vCPU is not tied to a physical core. The VM will run across many different cores on the host, or across cores on different hosts depending on your VMWare licensing/product features. So allocating multiple vCPU's does not automatically make your VM faster – it is purely presenting a CPU to your VM OS. The hypervisor handles vCPU to physical core allocation.

Thirdly, how does a vCPU access resources? It needs to wait for a physical core to be available. More vCPU's a VM is running, the more cores it needs access to simultaneously to get cpu time. As your vCPU oversubscription increases, so does CPU contention ratio, and the chances of having cores available to process requests from the VM.

Putting all this together, what do you come up with. The down and out of it is that unless you have less vCPU's allocated in total across VM's than you have physical cores, allocating lots and lots of vCPU's will eventually lead to less performance on your VM's, not increased.

Why? Because if you present 4 vCPU's to a VM OS, and it is using all 4 vCPU's to do work, you have to wait for 4 hypervisor cores to be available for the VM to get host time. With high contention ratios, this takes significant time.

The CPU Ready statistic on your VM will show how long it is taking for the VM to get hypervisor time. On a well performing environment, this should be under 20ms (vCPU request -> hypervisor core -> state returned). I have seen CPU ready at 100, 200, 500ms and in one case recently, 2700!!ms. 2.7 seconds, on average, waiting to get hypervisor cores. Meanwhile the VM runs very poorly, as do others due to the high vCPU to core contention ratio.

Realistically, if your VM is running SMP aware apps, allocate it 2 vCPU's. If it isnt, allocate it 1 vCPU. There is little real world scenario where you need to allocate more.

VMware vSphere 5能够运行功能比VMware vSphere 4强大4倍的虚拟机,最多支持1TB内存和32个虚拟CPU。


虚拟机的vCPU数量,直接表示的是虚拟机所能占有物理机器的资源大小。通过资源管理,还可以决定在发生资源竞争时,所能取得资源数量。所以,默认情况下,分配的vCPU越多,则所占资源越大,但是并不代表性能就越好。因为ESX里面的虚拟机的vCPU,实际上使用的物理CPU的时钟切片。分配的vCPU越多,则需要等待时隙,一8个为例,只有物理服务器上的8个CORE处在同一时隙时,VM才会进行数据处理。当然了,由于时钟切片本身很小,再加上处理器速度也很快,所以,通常情况下,感觉不到。当时当物理服务器有一定压力时,就会发现,分配很多vCPU的VM,性能就差强人意了

楼上的真是强人一个,一下就说到点子上了。无数的经验教训告诉我们,vCPU通常还是使用一个好。
确实的,应该根据vm本身平时的cpu占用率来分配vcpu,在1个就能处理的情况下尽量一个,多了也只会占用更多内存,性能的提高也不见得很大,亲身体会


其实,真需要8个VCPU的应用或许根本就不应该虚拟化。

8个VCPU支持是考虑到新一代的CPU,8核+Hyper Threading或许明年就能实现,4 SOCKET,16内核,这样一台ESX就是64个logical内核,那样8个VCPU可能还有意义。但目前,支持8 VCPU也没太大意义。

Solaris 10的Kernel scheduler要先进得多,忘记你又多少个内核,把它们都看成一个POOL,每个虚拟机可以分百分之多少的POOL。ESX借鉴了这个原理,但是受OS本身LICENSE的限制,还有WINDOWS HAL的局限。现在的UNIX不管单CPU,SMP都是用一个HAL,多少个CPU没影响,WINDOWS还分UP和SMP。

再返回来是说,8个VCPU并不见得就快过2 VCPU,原因已经解释过了。


Virtual CPUs (vCPU) in VMware virtual machines appear to the operating system as single core CPUs. So, just like in the example above, if you create a virtual machine with 8 vCPUs (which you can do with vSphere) the operating system sees 8 single core CPUs.
Note: Remember that 1 vCPU maps onto a physical core not a physical CPU, so the virtual machine is actually getting to run on 4 cores.


VMware虚拟机提速10招(转) http://techbbs.zol.com.cn/1/88_67.html

你可能感兴趣的:(vmware vcpu)