About Hyper-V Virtual Processor Limitations
I was reviewing older posts on the Petri IT Knowledgebase when I noticed an article called Virtual Processor Limitations in Hyper-V. It occurred to me that I should write an updated post that covers a few related topics. In this article, I will clear up a few myths about Microsoft guidance and talk about support virtual processor maximums in Hyper-V.
Virtual Processors versus Logical Processors
Consider a physical computer for a moment. This machine has one or more CPUs or sockets. Each CPU has a number of cores. Most Intel desktop or server processors feature something called hyper threading. This is a design that improves parallelization, enabling a single core to process two threads of execution at once. This isn’t truly a doubling of processing horsepower, but it does improve capacity when using modern software on a modern processor. In virtualization, it is important to understand how many logical processors a host has. If you have an AMD 8-core CPU, then that CPU has 8 logical processors (LPs). If you have an Intel 8-core CPU, then it will have 8 LPs if hyper threading is disabled and 16 LPs is hyper threading is disabled.
Each virtual machine you create also has one or more single-core virtual processors. Each virtual processor executes on a host’s LPs. What does this mean? If a host has 16 LPs, then the most number of virtual processors (vCPUs) that can be executing on the host hardware at once is 16. I’ve tried to use precise wording here because there is a subtlety; I can actually overcommit my processors by having lots more virtual machines in a running state. The hypervisor will swap virtual machines in and out on the physical processors based on demand and resource control.
Let’s make this clear with a few examples.
- I have a host with 16 LPs.
- At any one point in time I can have 8 virtual machines with 2 vCPUs executing on the physical processors. Or that might be 16 x 1 vCPU virtual machines, or 4 x 4 vCPU VMs, or any mix that makes up to 16 vCPUs.
- However, I might have 50 virtual machines with one or more vCPUs actually running on that host. The hypervisor will swap them in and out of the physical processor, so I don’t notice the over-commitment.
That might sounds scary if you’re new to virtualization, but we’ve been doing that sort of thing for decades with software, and it’s been the norm for the last 10+ years of machine virtualization.
Maximum Processor Counts
There are four factors to consider:
- How many logical processors are supported by your specific version of Hyper-V?
- What are the maximum number of vCPUs supported on a host?
- How many vCPUs are supported per LP on the host?
- What are the performance requirements of your guests’ services?
The first two questions are easy to answer with a search engine by querying ‘Hyper-V 2012 R2 Maximums.’ In the case of Windows Server 2012 R2 (WS2012 R2) Hyper-V, a single host can have up to 320 logical processors and can support up to 2048 vCPUs on 1024 virtual machines running on a single host.
Note: When you log into a host and run Task Manager, you will see a maximum of 64 logical processors on the host; rest assured that all the logical processors are there and used by the virtual machines — it’s just that a single install of Windows Server can only use up to 64 logical processors.
In the case of Windows Server 2008 R2 (W2008 R2) Hyper-V, a host can have up to 64 logical processors, and a single host can support up to 512 running vCPUs on 384 running virtual machines.
Older versions of Hyper-V applied a vCPU:LP ratio. In the case of server workloads, Microsoft supported 8 server vCPUs per LP in the host to be running at any one time. So if my host had 8 LPs, Microsoft would support me having 32 x virtual machines, each with a 2 vCPUs. For VDI workloads, we had a 12:1 ratio. That would mean my 8 LP host could run up to 96 virtual machines with a single vCPU each. Microsoft dropped this ratio with the release of Windows Server 2012 (WS2012) Hyper-V, which is because of the fourth question above.
In reality, all these ratios and counts are theory for exams. There is no “you can run X virtual machines” on a host rule in Hyper-V. Virtual machines on all platforms are just like physical servers in terms of resource requirements. Some services are heavy consumers of cores, some services require lots of cores for multi-threading, and some services are lightweights. Microsoft’s guidance is quite realistic: you can fit as many virtual machines onto your hardware as your hardware can support, and this is dictated by the workloads that you will run in those virtual machines. In the real world, you’ll hit a performance ceiling long before you hit the theoretical maximums of supported vCPUs per host.
Hyper-V Virtual Processor Best Practices
Microsoft does not have and never has had a general rule of having one LP per vCPU. However, some products from Microsoft have issued support guidance. Some products will support 2 vCPUs per LP, and some want a 1:1 assignment. This is a per-product guidance and affects only those virtual machines running those products. You can use Resource Control to enforce this guidance.
Another best practice is to not go crazy with assigning vCPUs. The MSDN Performance Tuning Guidelines for Windows Server 2012 R2 advises that you should only assign enough vCPUs to a virtual machine to meet the needs of that machine’s services. Wastefully assigning vCPUs will reduce the performance of the host and other virtual machines.
A related tip is to monitor the processor queue length within the guest operating systems of your virtual machines, especially mutli-threaded ones such as those running SQL Server. If this metric rises beyond acceptable levels then assign more virtual CPUs to the virtual machine.
More in Hyper-V
How to Install Hyper-V on Windows Server Core
Mar 16, 2022 | Michael Reinders
Microsoft Says There Will Be No Hyper-V Server 2022 Free Edition
Dec 13, 2021 | Michael Reinders
How to Stop an Unresponsive Hyper-V Virtual Machine
Jun 29, 2021 | Russell Smith
How to Enable Nested Virtualization in Hyper-V
Jun 28, 2021 | Russell Smith
Disaster Recovery with Azure Backup for SQL Server VMs
May 28, 2019 | Michael Otey
Leveraging Virtualization for Improved Availability and Disaster Recovery
Apr 29, 2019 | Michael Otey
Most popular on petri