7

I have a server (quad core) running Windows Hyper-V Server 2008 R2 with two Windows Server 208 R2 Standard guest virtual machines.

I've noticed the number of logical processors setting (under the Processor) settings page for each VM defaults to 1, but allows me to choose anything from 1 to 4 "virtual processors" (or "logical processors" equivalently I suppose).

My questions are: a) Do these "virtual processors"/"logical processors" map directly to cores on my Intel Q6600 quad-core CPU? b) Is it advisable to set the number to 2 for both guest VMs in this case? Does that leave sufficient CPU power for the Hyper-V host?

Along with processing power, I'm also wondering whether/how I can reserve a certain amount of RAM for the Hyper-V host.

2 Answers 2

4

It is a trade-off. Say you have four physical cores and two VMs.

If you map two virtual cores in each VM, then pretty much each guest will see what it expects. It will see two cores that it expects to have full control over and more or less get that. (Assuming host load isn't high.) You won't often confuse the guest's scheduler with a case where it assigns a task to a core expecting the task to be done immediately and instead the task does not get done because no physical core is available. However, if one guest is CPU-starved and the other is idle, two cores will be twiddling their thumbs.

On the other hand, if you give each guest four virtual cores, each guest will be able to use all the available CPU power when the other guest and the host don't need it. However, when there is load from another source, the guest's scheduler will not get the behavior it expects and some tasks will get started immediately and some won't in a way that the guest's scheduler can't easily expect and deal with.

My recommendation is generally to put as many physical cores as you have in each VM that might ever be expected to need a lot of CPU. The exception would be if you have VM's that are critically dependent on latency. I would also reduce the core count on any "smaller" or "less important" VMs that share a physical box with more critical VMs.

The hypervisor assigns logical cores to physical cores as part of its scheduling policy. There is no fixed mapping unless you specifically make one. (Which I don't recommend except in the one specific case where you want to reserve a core for a latency-critical VM.)

1
  • Thanks for the answer and details, David. I suppose what also confused me a little was the seeming redundancy with the resource allocation (percentages for both CPU and RAM) in the same config window. Do you play around with these at all? Anyway, from your advice I'm considering assigning 3 cores to my "public" (HTTP/FTP) VM server and 2 cores to my "private" (file/print) server...
    – Noldorin
    Dec 10, 2011 at 3:44
1

No, there is no direct mapping of logical processor vs physical processor... per-se... basically a new thread is created for each logical processor with the affinity set to a specific physical core... so each thread can consume 100% of the resources on each core. Allocating 2 machines to all 4 cores (2x4 logical cores) may or may not be a good idea. If your applications are cpu-intensive... or spawn lots of threads on both machines... both will lag periodically waiting for the other to finish... assigning dedicated cores per-instance means that there will be minimal delay throwing tasks at the CPU.

You can't really dedicate a specific amount of RAM to the host... other than limiting the amount the guests can consume. You can in other virtual frameworks... but hyper-v is the new-kid on the block without all the bells & whistles of the old-timers.

5
  • There are actually two problems with this answer. First, the virtual processors aren't tied (affinitized) to any specific core. They can run on any core. Second, you can dedicate a specific amount of RAM to the management OS (host.) There's a registry key for that called the "root reserve." Dec 10, 2011 at 1:27
  • I guess @TheCompWiz means "dynamically" affinitised, if there's such a thing>? i.e., Affinitised on a temporary basis while resources are needed. Just a guess. Thanks for the details anyway.
    – Noldorin
    Dec 10, 2011 at 3:46
  • @Jake Oshins: Mind linking me to a description of this registry key please?
    – Noldorin
    Dec 10, 2011 at 3:46
  • Microsoft's links change all the time. Here's a search which, today, returns the answer as the first result: bing.com/search?q=hyper-v+root+reserve+registry&src=ie9tr Dec 11, 2011 at 19:48
  • @JakeOshins you're correct in the literal sense... but the concept was what I was trying to express. I.e. a single core will never consume more CPU than a single physical CPU can provide... and having more virtual cores assigned than physical cores means that some virtual instances will share CPU time. Thanks for the link to the root reserve... I've never seen that one before.
    – TheCompWiz
    Dec 12, 2011 at 15:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .