2

I have a question regarding a recommendation for setting up vCPU on a hyper-v virtual server. Documentation for the application states "For best performance, configure a 1-to-1 allocation of virtual processors to available Hyper-V Host logical processors" but I find this a bit confusing.

I have two hyper-V host server types in different clusters.

A hyper-v host with 4 sockets, 40 cores, 80 logical processors, 64 host logical processors, and.. A hyper-v host with 4 sockets, 60 cores, 120 logical processors, 64 host logical processors

I'm looking for some clarity on exactly what a 1-to-1 allocation of virtual processors to available Hyper-V Host logical processors means in this scenario.

gBrner
  • 51
  • 1
  • 3
  • 1
    Could you link the documentation you are quoting from? – Daniel Dec 01 '16 at 13:11
  • It was a PDF sent to me. I copy and pasted that particular paragraph completely below as FYI: To avoid low CPU performance, see the following guidelines: • Refer to customer sizing for the actual amount of virtual CPU (vCPU) needed. • Make sure Virtual NUMA (vNUMA) is enabled on Hyper-V Host. See Microsoft's knowledge base article 614459. • For best performance, configure a 1-to-1 allocation of virtual processors to available Hyper-V Host logical processors. • In any case, a minimum of two vCPUs is required. • Set the reservation at 100% for the CPU configuration. – gBrner Dec 01 '16 at 14:30

2 Answers2

0

I'm not sure what doc you are referring to, but it makes sense. For best performance you wouldn't want to "overcommit" on CPU resources. Granted that being able to overcommit on CPU cores is likely the reason why we are virtualizing, if you had a 1-1 ratio, you'd get the best performance. So by this rule of thumb, if I had a single hex core system (12 logical procs, if hyperthreading is enabled). I could put 12 single vcpu vms, 6, 2 vcpu vms,etc) keeping that ratio 1-1.

The real question is will your application will likely be just fine in a more typical vcpu/logical ratio it does it really need to be 1-1. You'll have to make that call based on what the app does.

Jim B
  • 23,938
  • 4
  • 35
  • 58
  • Hyperthreading doesn't really give you double the cores. CPU bound, latency sensitive workloads benefit from limiting vCPU to the number of cores. Yes, this is expensive. Although, if your VMs are mostly idle sure try overcommit. – John Mahowald Dec 01 '16 at 15:21
  • Yes, the example was showing what you would observe as the number of logical cores. – Jim B Dec 01 '16 at 18:24
0

In Hyper-V there is no processor allocation. You cannot allocate a virtual processor (VP) to a logical processor (LP).

At least since Hyper-V 2012 (I think even 2008 R2) Microsoft gives no suggestions on the VP per LP ration (source for 2016)

But it is also true that a single VP always executes on a single LP. Even if you overcommit the host, which is totally possible, Hyper-V manages the recources by checking VPs in and out of LPs. So overcommittment is not generally a bad thing. For example, Hyper-V 2016 allows for a single VM to have 240 virtual processors! A single host supports 2048 virtual processors!

The only thing to keep in mind is that you should not overcommit VPs on a Hyper-V host if you have less virtual machines on it than logical processors. Because then CPU swapping happens which would (maybe not noticably, but it would) affect performance.

If you are uncertain how many VPs you assign a virtual machine, start with a number you feel comfortable with and monitor the CPU load over a timeframe. Then adjust the VPs accordingly.

Daniel
  • 6,780
  • 5
  • 31
  • 60
  • I agree but this question is about the app recommendation, not the hyper-v recommendation or settings – Jim B Dec 01 '16 at 18:26
  • The app recommendation makes no sense. `For best performance, configure a 1-to-1 allocation of virtual processors to available Hyper-V Host logical processors` So what? Should I really add as much VPs as I have LPs? Because then I scrap the Hypervisor and run the app bare metal. And allocation is simply not possible. It is in the nature of Hyper-V that a VP executes on a LP, but not because the admin makes that decision but because Hyper-V is built that way (if you don't overcommit, that is.) – Daniel Dec 01 '16 at 22:14
  • I've dealt with apps like this in the past. Some of them actually say this because it really does inhale CPU and probably shouldn't be virtualized, but if you do you simply can't assign more vcpus than you have. – Jim B Dec 02 '16 at 02:51