DEV Community

Alex Tray
Alex Tray

Posted on • Originally published at jayisgames.com

Ways to Improve Gaming Performance in Hyper-V

Gamers are increasingly turning to virtual machines (VM) to play video games, and for good reason. Virtual machine gaming delivers better security, flexibility, and convenience. Yet, using games requiring high-end graphics can cause a deterioration in VM performance.

What are the benefits of gaming on a virtual machine? And how to make a VM run faster? This blog answers these questions and provides you with a roadmap to optimize your Hyper-V performance for a better gaming experience.

Virtual Machines and the World of Gaming
In short, a virtual machine is a computer (that is, the guest VM) inside a computer (that is, the host machine). The virtual machine (VM) can run an operating system separately from the host machine’s operating system while using the host CPU, memory, and disk. The operating system on your physical machine is the host OS, while the operating system inside the virtual machine is the guest OS.

Each virtual machine is entirely independent and runs its operating system separately from other VMs. Users can create and run as many VMs as they want on a hypervisor, such as Hyper-V, Microsoft’s virtualization technology. This hypervisor manages the resources allocated to these virtual environments from the physical machine.

Hence, VMs allow users to make the most of their hardware by creating virtual computer environments. Currently, such virtual environments can be used by gamers for the many benefits that virtualization brings to the table.

Benefits of virtualization for the gaming world

There are many reasons why gamers are currently using a virtual machine for gaming, but the main advantages include:

Gaming using different operating systems
In addition to managing all the computer’s hardware and software, operating systems are responsible for managing resources. However, each operating system allocates and manages the computer’s resources
differently, affecting gaming performance. Using virtual machines for gaming can provide you the opportunity to use different operating systems depending on the game in question.

System backup and recovery
Virtual machines are files, and like any files, they can be backed up, stored, and restored. Hence Hyper-V backup should be a necessary part of your disaster recovery strategy.

Isolating Threat
Since virtual machines run independently from one another, this gives your virtual environment a layer of security. You protect your computer from viruses and other malware infections when you use dedicated virtual machines for gaming. In other words, if the gaming VM or any other VM on the host gets infected, you are protected because a problem with one VM does not affect the others. This keeps the host protected and makes it possible to replace the infected VM with a new one without affecting the entire environment.
Minimizing downtime
The fact that you can move your virtual machine from one hypervisor to another on a different physical machine means that you have a great plan in place. If your host goes down, you can move all your virtual machines to another functioning physical machine. Hence, you can continue gaming without interruption.

Now that we listed the benefits of using a virtual machine let's start by creating one.

How to Create a Virtual Machine
Before creating a virtual machine and installing the operating system, ensure that your system meets all of the following requirements:

Windows 10/11 Enterprise, Pro, or Education, Windows Server 2008 and later
64-bit Processor
CPU support for VM Monitor Mode Extension
Minimum of 4 GB of memory (RAM)
Virtualization BIOS settings are enabled

Let’s get started by enabling the built-in Hyper-V feature:
Open the Control panel.
Select Programs and Features.
Select Turn Windows Features on or off.
Select Hyper-V and click ok.

Now let’s create a virtual machine:
Open the Control Panel.
Select Administrative Tools.
Select Hyper-V Management.
Select the host to enable the action panel.
Click on the new Virtual machine.

In the following steps, you can choose the virtual disk location and all the other specs (CPU, RAM, Disk space). Finally, add the operating system (OS) image that you want to install and then run the OS installation.
How to Improve Hyper-V Performance Using GPU Passthrough
Virtual machines do not have full access to their host’s complete capabilities but rather what is allocated to them by a hypervisor. Hence, gaming on a virtual machine, especially for games requiring high-end graphics or high-resolution visuals, can slow down performance, as they require a lot of CPU power.

In such cases, you can optimize the performance of your virtual machine by ensuring that it is utilizing your host’s physical graphic cards. This can be achieved by assigning a graphical processing unit (GPU) to your virtual machine. Such an assignment differs depending on the type of VM host you are using.
A GPU passthrough can provide your virtual machine direct access to your GPU, which optimizes the performance within your VM. Note, however, that GPU passthrough is only available for Windows Server 2016 and later.

GPU passthrough relies on Discrete Device Assignment (DDA), which enables graphic adapters and non-volatile memory express (NVME) storage devices to be directly accessible from a virtual desktop. DDA ensures extra performance and redirects the graphics load to the GPU.

To benefit from this feature, you need to ensure that your physical machine meets both the requirements of the Windows server and of the game itself. The installation requires users to have basic knowledge of PowerShell scripting.

Also, there are other ways to improve Hyper-V performance.
9 Tips to Optimize a Virtual Machine for Gaming

Even though virtual machine gaming using Windows user versions have certain limitations in terms of high-end graphics or high-resolution visuals, you can optimize your personal computer to get the best performance by following the below steps:

  • Avoid using driver compression or encryption of any kind.
  • Keep at least 1 GB of free RAM on the host.
  • Use Solid State Drives (SSD) for hosting your VMs. SSD has more input-output speed(I/O), increasing the read and write disk speed.
  • Use a fixed virtual hard disk (VHD) when creating your virtual machine on which you are running games to ensure a better performance.
  • Avoid overloading the management operating system by running unnecessary applications on the host while playing games.
  • Allocate resources effectively by identifying your existing resources and how many you need to achieve the maximum performance for your virtual gaming machines.
  • Use the Dynamic Memory feature, which enables Hyper-V to allocate more memory (RAM) to a VM when needed or reclaim excess back when a VM is idle. This way, your game can use all the RAM required for better performance.
  • Defragment virtual machines and host hard disks. Disk fragmentation occurs when files or pieces get scattered throughout the disk, causing poor performance.
  • Properly configure your antivirus. Otherwise, it can interfere with critical processes and operations of the VM.

Top comments (0)