14

We have recently purchased a server which is running Hyper-V 2008 R2 bare metal. The server has two quad-core Intel Xeon processors with hyperthreading, so if I'm understanding correctly this gives us 16 cores. Within Hyper-V we have created a virtual machine running Windows Server 2008 R2 with 4 virtual processors. The processor settings screen is telling me that this represents 25% of the total system processing power. Does this mean that the remaining 75% can not be tapped into by the virtual OS? We will be running a few other virtual machines, but this one is for SQL Server and we'd like to throw as much horsepower at it as possible.

Scott
  • 1,173
  • 3
  • 13
  • 25
  • 5
    You want to be exceedingly careful about allocating vCPUs to a machine. It means that the virtual machine has to wait until there are 4 physical processors are available *at the same time* before it can execute. See [here](http://lonesysadmin.net/2008/04/22/why-my-two-vcpu-vm-is-slow/) – Holocryptic May 16 '11 at 18:36
  • 6
    As far as Hyperthreading goes, take a look at this excellent primer: http://arstechnica.com/old/content/2002/10/hyperthreading.ars/ – Hyppy May 16 '11 at 18:38
  • 4
    Holocryptic, your statement was true of older VMWare systems, but it has never been true of Hyper-V. Hyper-V doesn't "gang schedule" the virtual processors. – Jake Oshins May 17 '11 at 05:59

4 Answers4

15

A vCPU can only be mapped to a single physical CPU. You can't take 4 physical CPUs and make a single vCPU that's 4x faster; it's just not how it works.

Hyper-V is limited to assigning 4 vCPUs to a VM (last I checked). If you need significant CPU power, go physical, there's no sense in adding virtualization overhead to something that CPU intensive and parallel in the first place.

Also, as Holocryptic notes, if you assign 4 vCPUs to a VM, that VM can't run until Hyper-V has acquired 4 physical CPU cores to run them on. Depending on your configuration this could be a major stumbling block (ex, if you have a 6-core machine with a bunch of 4 vCPU VMs, only one will ever run at a time, the other two cores will always go essentially unused). According to Jake Oshins this was not true for any version of Hyper-V. He states that Hyper-V does not use gang scheduling for the CPU; as almost every other hypervisor does. Accordingly, if one phystical CPU core is available, Hyper-V may use it to run a multi-CPU VM. (Also mentioned, Hyper-V may not use all the physical cores available at the time because of NUMA partitioning)

Side note: SQL doesn't necessarily use all the cores you can throw at it in the first place. It really depends on what you're using it for and how parallelizable the load is.

Chris S
  • 77,337
  • 11
  • 120
  • 212
  • I agree, but the overhead on virtual CPUs is almost nothing, and rarely comes into play. – Nate May 16 '11 at 18:42
  • 4
    Chris, Holocryptic's note is simply wrong. Hyper-V does not wait until there are 4 virtual CPUs free before scheduling a virtual processor from a 4 VP VM. Hyper-V schedules a virtual processor whenever it has a physical processor free to run it on, with a few caveats. For instance, it looks for physical processors within the same physical NUMA node as the rest of the VM. – Jake Oshins May 19 '11 at 05:33
3

Yep, What Chris said. If you need more then 4 CPU's in a Hyper-V virtual machine then either create two SQL servers in virtual and spread out your databases or go physical. Depending on your SQL server license you may be able to add more SQL servers in virtual (on the same physical host) without occurring more licensing costs, but read the SQL virtual licensing white paper for more info.

I would also agree that if you have SQL running out of CPU power with 4 virtual CPU's then you've either got some serious app utilization or the SQL commands are badly written.

Bret Fisher
  • 3,963
  • 2
  • 20
  • 25
  • 1
    Re: "...or the SQL commands are badly written." This is almost guaranteed, whenever vendor-supplied code is in play. – Skyhawk May 16 '11 at 20:33
  • Indeed, most database traffic is OLTP stuff from our ERP system. We also have a workflow system from the same vendor. Custom stuff written in-house is a small percentage. – Scott May 17 '11 at 15:53
  • Our old database is running maxed out on 4 logical cores (two dual-core CPUs), so we're expecting to need more than that. – Scott May 17 '11 at 15:55
0

About 4 CPU core limit:

In VM's config file section:

[processors] [count type=”integer”]16[/count]

Now you have 16 core CPU.

UPDATE: Seems screenshot needed

enter image description here

Nime Cloud
  • 454
  • 1
  • 4
  • 17
0

follow this guide

http://surminski.eu/2012/04/17/hyper-v-how-to-add-more-than-4-cores-to-a-virtual-machine/

you can locate the vm xml configuration file under the "Virtual Machines" directory of the VM's VHD directory, the configuration file will be named under the VM's id. Below link is a reference.

reference: VM xml configuration file

make sure you edit the VM xml configuration file with notepad/notepad++ opened under administrator privileges

Shuliyey
  • 101
  • 1