Wednesday 28 September 2011

A Big Picture View of VM Density: vCPUs to Cores?

This is a repost of our comment made on the following Microsoft Forums:

An eight core CPU without Hyper-Threading has the ability to process 8 threads simultaneously. To keep things simple we will avoid the HT conversation.

An important point to keep in mind that the number of vCPUs assigned to a VM = the number of threads that _have_ to pass through the CPU _at the same time_.

So, a VM with 4 vCPUs would have to have 4 threads processed simultaneously.

Now, this is where things get a little sticky, and the reason why the linked article discusses the VP:LP ratio as being important (link below).

With 8 threads available to us on your CPU we can use your 5 VM with 2 vCPUs as an example. Note that each bullet represents a set of 8 possible threads that can processed by the CPU.

Okay, so theoretically the physical CPU could process four VM's vCPUs simultaneously (NOTE: * = thread):

  • |**|    |**|    |**|    |**|
  • VM1 VM2 VM3 VM4

Now, this is the "sticky" part:

  • |*|   |**|    |**|    |**|
  • OS VM5 VM1 VM2

In the above example we have two VM's vCPU threads being processed and one OS core service thread. Now, that leaves one core empty due to the way the CPU queues and processes threads.

Because of the way the physical CPU queues and processes threads Microsoft has come up with the VP:LP ratio. It is to help us to understand at what point the CPU's queue will become overwhelmed by all of the VM's threads waiting in the queue to be processed.

Also note that Microsoft is explicit about defining the VP:LP for the Windows 7 desktop OS as being different than any other configuration because as soon as we introduce vCPUs running with 3, 4, and now with more threads the number of cores in a system becomes all the more important for overall system/VM performance.

Taking that we can see the following as being possible:

  • |****|  |**|    |*|
  • VM6 VM1 OS
  • |**|    |****|   |**|
  • VM2  VM7 VM3
  • |*|    |****|   |**|
  • OS  VM6  VM4

And so on. Notice that because the 4 vCPU VMs require those four threads to be processed simultaneously the queue gets a little longer due to the CPU's need to juggle which threads get processed when.

Today's CPUs are vastly better at working in these types of environments due to improved internal logic, data path efficiencies improved, Hyper-Threading (we don't put too much into this feature), and more. Thus: YMMV. :)

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

*Our original iMac was stolen (previous blog post). We now have a new MacBook Pro courtesy of Vlad Mazek, owner of OWN.

Windows Live Writer

No comments: