Linux VM Performance on Hyper-V

, ,

I was recently on a call with a customer who had migrated their VMs to a new Hyper-V host (and away from VMWare) and had a few Ubuntu VMs for hosting their PHP stack of applications. Part of the call we were doing a review of some of the VMs and the customer complained that they were facing some performance issues with the Ubuntu VMs that they previously never had with VMWare.

Now while Linux Guest Support for VMWare is pretty much plug and play, the same cannot be said for Hyper-V. While the VM Guests are these days enlightened with some base integration services, Ubuntu still uses the generic kernel when being installed in Hyper-V, so there can be issues around integration services and performance around disk utilisation. So after the call with that customer, the action items were to adjust the kernel for these two VMs.

Microsoft recommend using the linux-azure kernel when running Linux under Hyper-V and if ever migrating into Azure. Switching Kernels is a fairly painless process, however isn’t fraught without danger (so make sure you backup or snapshot prior). Connecting to the VM, we firstly check the current kernel that is running by using the following command

uname -r

This returns linux-generic and confirms that we need to change, so we will now install the azure packages and kernel using the following command

sudo apt install linux-azure

While you can be more selective about what you’re installing, I’d generally just use this over-arching set of packages. Once saying yes to install and it completes, we need to reboot to load the new kernel. As the machine reboots, we should notice the heartbeat and network details get filled in as the Guest is now enlightened and providing information back to the Hypervisor.

There are other things to watch out for like file system block size matching your underlying storage infrastructure that can also hamper performance especially for systems with large files, so take note when creating the VM.


Leave a Reply

More Posts

Admin SVC Error when trying to install SharePoint solutions (WSP) and how to fix it

Short and sweet post about deploying SharePoint solutions.  You usually do this by invoking Install-SpSolution under the SharePoint PowerShell, but sometimes you’ll get the following error: Install-SPSolution: Admin SVC must be running in order to create deployment timer job All you need to do is to go to the Services section in Control Panel\System and Security\Administrative Tools […]