Deciding On How Many vCPU’s Should A Virtual Machine Be Allocated ?


I suppose I should start by stating that this post’s main focus is around VMware’s CPU Schedular.

The Difference Between CPU usage In A Physical And Virtual World

Physical servers typically have a single or multiple CPU’s (multiple cores). A hypervisor provides an additional layer between the OS and the physical CPU allowing the use of Virtual Machines (sharing the physical hardware). The Virtual Machine OS talks to the Virtual CPU’s, and requests made from the Virtual Machine are scheduled by the hypervisor (VMware’s CPU Scheduler), across physical CPU cores.

CPU Scheduling enables greater utilisation and sharing of physical CPU resources. This makes virtualisation the favoured choice in modern data centres, as it provided reduced costs, consolidation and greater flexibility.

The Performance Impacts Of CPU Processing Using One Or More Virtual CPU’s

Physical Environments:

A typical physical server has multiple CPU’s available for the hosted primary application. If the server’s primary application is not multi-threaded, you would essentially be wasting the available resources. This is one benefit of using Virtual Machines (maximise resource utilisation).

Virtual Environments:

The first thing to understand when allocating CPU’s to a Virtual Machine, is how CPU scheduling works. CPU scheduling is the process used to allocate physical CPU time slots to vCPU’s in Virtual Machines.

How VMware CPU Scheduling Works:

You have one Physical Hypervisor (ESXI) with one physical CPU, 12 cores and 16 virtual machines. You can have upto 12 virtual machines using CPU resources at one time. The remaining 4 will have to wait. The longer the virtual machines have to wait, the slower they will run.

In addition to this Please see the extract from the vSphere Resource Management Guide

“Single-threaded applications can take advantage only of a single CPU. Deploying such applications in dual- processor virtual machines does not speed up the application. Instead, it causes the second virtual CPU to use physical resources that other virtual machines could otherwise use.” 

Some Key Points To Note When Deploying Virtual Machines:

Only allocate the required resources, start off with the minimum and add additional when required.

  •  1 vCPU – requests are processed quickly
  •  Multiple vCPU’s – The hypervisor CPU schedular must wait for physical CPU’s to become available
  •  Over allocation (commitment) could result in poor performance.

The rule of thumb when allocating CPU’s to a Virtual Machine (Best Practise) is to allocate 1 vCPU and then test the CPU utilisation. When adding Multiple CPU’s you will need to plan your resources better. VMware’s Operations Manager can provide utilisation stats showing possible performance issues.

Key MS products that should be considered for multiple vCPU’s:

  • MS Exchange 2010/2013
  • MS Sharepoint 2010/2013
  • MS Lync 2010/2013
  • MS RDS 2012 infrastructure.

For more information on VMware’s CPU scheduler, have a look at the white-paper

Also have a look at the following article regarding None Uniform Access Memory (NUMA).

NUMA Performance consideration in VMware vSphere

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a website or blog at WordPress.com

Up ↑