How do you increase the number of cpus in a virtual machine in order to optimize it?

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Hyper-V Processor Performance

  • Article
  • 05/19/2022
  • 3 minutes to read

In this article

Virtual machine integration services

The Virtual Machine Integration Services include enlightened drivers for the Hyper-V-specific I/O devices, which significantly reduces CPU overhead for I/O compared to emulated devices. You should install the latest version of the Virtual Machine Integration Services in every supported virtual machine. The services decrease the CPU usage of the guests, from idle guests to heavily used guests, and improves the I/O throughput. This is the first step in tuning performance in a server running Hyper-V. For a list of supported guest operating systems, see Hyper-V Overview.

Virtual processors

Hyper-V in Windows Server 2016 supports a maximum of 240 virtual processors per virtual machine. Virtual machines that have loads that are not CPU intensive should be configured to use one virtual processor. This is because of the additional overhead that is associated with multiple virtual processors, such as additional synchronization costs in the guest operating system.

Increase the number of virtual processors if the virtual machine requires more than one CPU of processing under peak load.

Background activity

Minimizing the background activity in idle virtual machines releases CPU cycles that can be used elsewhere by other virtual machines. Windows guests typically use less than one percent of one CPU when they are idle. The following are several best practices for minimizing the background CPU usage of a virtual machine:

  • Install the latest version of the Virtual Machine Integration Services.

  • Remove the emulated network adapter through the virtual machine settings dialog box (use the Microsoft Hyper-V-specific adapter).

  • Remove unused devices such as the CD-ROM and COM port, or disconnect their media.

  • Keep the Windows guest operating system on the sign-in screen when it is not being used and disable the screen saver.

  • Review the scheduled tasks and services that are enabled by default.

  • Review the ETW trace providers that are on by default by running logman.exe query -ets

  • Improve server applications to reduce periodic activity (such as timers).

  • Close Server Manager on both the host and guest operating systems.

  • Don't leave Hyper-V Manager running since it constantly refreshes the virtual machine's thumbnail.

The following are additional best practices for configuring a client version of Windows in a virtual machine to reduce the overall CPU usage:

  • Disable background services such as SuperFetch and Windows Search.

  • Disable scheduled tasks such as Scheduled Defrag.

Virtual NUMA

To enable virtualizing large scale-up workloads, Hyper-V in Windows Server 2016 expanded virtual machine scale limits. A single virtual machine can be assigned up to 240 virtual processors and 12 TB of memory. When creating such large virtual machines, memory from multiple NUMA nodes on the host system will likely be utilized. In such virtual machine configuration, if virtual processors and memory are not allocated from the same NUMA node, workloads may have bad performance due to the inability to take advantage of NUMA optimizations.

In Windows Server 2016, Hyper-V presents a virtual NUMA topology to virtual machines. By default, this virtual NUMA topology is optimized to match the NUMA topology of the underlying host computer. Exposing a virtual NUMA topology into a virtual machine allows the guest operating system and any NUMA-aware applications running within it to take advantage of the NUMA performance optimizations, just as they would when running on a physical computer.

There is no distinction between a virtual and a physical NUMA from the workload's perspective. Inside a virtual machine, when a workload allocates local memory for data, and accesses that data in the same NUMA node, fast local memory access results on the underlying physical system. Performance penalties due to remote memory access are successfully avoided. Only NUMA-aware applications can benefit of vNUMA.

Microsoft SQL Server is an example of NUMA aware application. For more info, see Understanding Non-uniform Memory Access.

Virtual NUMA and Dynamic Memory features cannot be used at the same time. A virtual machine that has Dynamic Memory enabled effectively has only one virtual NUMA node, and no NUMA topology is presented to the virtual machine regardless of the virtual NUMA settings.

For more info on Virtual NUMA, see Hyper-V Virtual NUMA Overview.

Additional References

  • Hyper-V terminology

  • Hyper-V architecture

  • Hyper-V server configuration

  • Hyper-V memory performance

  • Hyper-V storage I/O performance

  • Hyper-V network I/O performance

  • Detecting bottlenecks in a virtualized environment

  • Linux Virtual Machines

Feedback

Submit and view feedback for

How can I increase my CPU?

Core Settings In Windows 10 Type 'msconfig' into the Windows Search Box and hit Enter. Select the Boot tab and then Advanced options. Check the box next to Number of processors and select the number of cores you want to use (probably 1, if you are having compatibility issues) from the menu. Select OK and then Apply.

How many CPUs should I give my virtual machine?

Set the Number of Virtual Processors.

How many virtual CPUs can you configure on a virtual machine?

A single virtual machine can be assigned up to 240 virtual processors and 12 TB of memory. When creating such large virtual machines, memory from multiple NUMA nodes on the host system will likely be utilized.

What is the maximum number of virtual CPUs that the virtual machine can be allocated?

The maximum number of virtual processor sockets assigned to a VM is 128.