Wednesday, 24 October 2012

2012 Hyper-V VM Performance: vCPUs, Threads, and Cores

Now that we have the ability to assign a large number of vCPUs to a VM we need to keep in mind that more vCPUs may not actually mean better performance.

The main thing to keep in mind is that _all_ threads associated with a virtual machine must be processed at the same time. So, 12 vCPUs assigned to that VM? Then 12 threads must run through the pipeline simultaneously to be processed by the CPU or CPUs.

That is why an 8 Core single socket setup will only show a maximum number of 8 vCPUs that can be assigned to one VM (assume Hyper-Threading off).

So, okay, we have a dual socket server with a pair of 8 core CPUs that can process a total of 16 threads simultaneously.

If we go ahead and assign 10 vCPUs to that VM we may assume that we would get more processing out of that database driven application.

The catch is the simultaneous 10 threads now need to be split between CPU 0 and CPU 1 in order to be processed together.

That means that CPU cycles will be lost while the pipeline logic juggles all of the other threads running through the CPU pipeline to get those 10 done. Part of that process will be to toss the extra two threads across the QuickPath Interconnect (Intel diagram) between the CPUs.

Essentially all of this extra juggling costs CPU cycles.

If we take the same high load VM and assign 8 vCPUs, the maximum number of threads that can be processed on one physical CPU, and compare its performance to the VM with 10 vCPUs on the same physical server we can pretty much guarantee that the VM with 8 vCPUs will outperform the one with 10 vCPUs.

In the end we need to have a pretty good idea of just how a virtualization stack will behave on the various platforms we use to deploy Hyper-V standalone, Hyper-V Failover Clusters, or now Hyper-V with Live-Migration enabled.

NOTE: Test in a lab before deploying in production. :)

Philip Elder
MPECS Inc.
Microsoft Small Business Specialists
Co-Author: SBS 2008 Blueprint Book

Windows Live Writer

No comments: