How to Improve Performance of a QNAP VM Using Virtio Drivers


Today, we’re going to install Virtio drivers for a QNAP virtual machine running Windows. Though I’m using Windows Server 2016, this tutorial applies to all modern versions of Windows, including Windows 7, 8, and 10. In the video, I’ll focus on hard disk and network drivers, and I’ll perform some basic before-and- after benchmarks, testing the disk and network performance. In a previously published video, I showed you how to install a virtual machine in QNAP’s Virtualization Station using Microsoft’s Windows Server 2016. I’m going to use that base install of Windows as a starting point in this video. By default, all access to physical hardware, such as the hard disk and the network card, is emulated, which means performance is going to suffer. Virtio is a virtualization standard where the host operating system communicates with the back-end disk and network drivers on the host machine. This is Windows Server 2016 in the state I left it in my prior video, which basically means that it’s a default Windows install using the default settings of Virtualization Station – so I’m running the emulated drivers right now. I’m going to run some tests before I install the Virtio drivers. I’ll go ahead to the Device Manager through the Control Panel, and just show you the drivers that will be changing when I install the Virtio drivers. The main focus is the disk drive, where it’s using an emulated driver, and the network adapter. Virtio will also install a couple of other things, like a SCSI device under Storage Controllers, and a memory management driver under System Devices – things that don’t exist at the moment. But like I said, we’ll focus on the hard disk and the network. Let me close out of these… and start Crystal DiskMark 6, which is going to run a basic hard drive speed test. I’m going to use the default values to run all the tests. I should mention that I’m not running any operations on the QNAP – there’s no backups going on; there’s no other virtual machines running; so this is about as pure of a test that I’ll be able to perform. The virtual machine is sitting on a couple Hitachi 2 TB, 7200 RPM drives in RAID 1. This will take some time, so I’m going to fast forward… and here are the results of the first run of DiskMark. I’ve run it a couple more times just to make sure I’m getting consistent numbers – and we see that we’re getting approximately 75 MBps read and write speeds for the sequential tests, and then about 0.6 MBps read and 1 MBps write for the three other 4K tests. I’ll use this middle run as the representative numbers for this test. Next, I’ll run a LAN speed test to check the performance of the network. This relies on a shared folder on the network, so let me click on this ellipsis button, and type in a shared folder on the network. I’ll need to enter my credentials here… Click OK… I’ll leave everything on their default settings again for the test… and hit the Start Test button. I’ll run this test a couple more times and compare the numbers. Looking at the three tests, it looks like I’m getting about 125 Mbps up and 360 down. I’ll take the second run as my representative numbers for this test. Finally, I’m going to take a file that’s about 2 GB in size, and copy it across the network. Let me go ahead and right-click the file, and copy it… then navigate to my shared network folder… and paste it there. You can see it’s transferring quite slowly. I’m on a gig network and I routinely copy files at about 100 MBps. We’re seeing speeds about a third of that. So that completes our basic testing. I’m going to close out of that… then shut down the VM because we need to change some settings while it’s shut down. Let’s go ahead and install the Virtio drivers. The first thing you’ll want to do is visit fedoraproject.org/wiki/Windows_Virtio_Drivers. The address is shown here if you want to pause the video. I’ll click on the direct download link, where you can select among a few choices for the Windows drivers. There’s the stable drivers if you want a set that’s been tested, or you can grab the latest and greatest, which haven’t gone through any testing. I myself prefer the stable version, so I’ll go ahead and click that. This file that we’re downloading is just a CD full of drivers in ISO form, which we’ll need to mount later in Virtualization Station. So keep track of where you’re saving it, because you will need to transfer this file to the QNAP later on. I’m going to fast-forward this part… OK, the file has been downloaded, and I’ve copied the file called virtio-win-0.1.141 to my QNAP. It’s in a shared folder called VM. If you’ve watched my previous video, you’ll remember this is where I placed the ISO image of the Windows Server installer. What you’ll want to do next is log into the QTS operating system. I’ll hit login… and enter the system. Open up your Virtualization Station, and head over to the VM in which you want to install the Virtio drivers. I have two VMs set up, but this first one is what I’m going to use in this tutorial. Click the Settings icon… and then tab over to Settings. You’ll then want to click over to the Network section. You’ll see that it’s listing Intel Gigabit Ethernet, which is the emulated driver. When I drop down the box, you’ll see Virtio listed at the bottom. We’re gonna change this to Virtio, because we want to introduce this new device to Windows the next time we start up the VM – kind of like how you add new hardware to your PC and Windows tries to detect it, so it can install the correct drivers. Let’s hit Apply. Note that we won’t have access to the network because we’re swapping out the Ethernet device, just like we would swap out a physical NIC card in your computer. Next, let’s move over to the Storage section. Here, we want to follow the same technique of introducing new hardware, but the problem is that if I switch my main hard drive to Virtio, I won’t be able to access it. I wouldn’t even be able to boot into it, because we haven’t even installed the Virtio drivers yet. So we want to keep this as IDE. So how do we get the Virtio disk drivers installed? It’s simple – we introduce another hard drive to the VM. This is like a dummy hard drive because, its sole purpose is to introduce the new Virtio device to Windows in order to install the drivers. I’ll change the interface to Virtio, keep the default location, and reduce the size of the disk to 1 GB, because it really doesn’t matter what size it is. Once I click OK, you can see I have two hard disk devices – one is my original with Windows Server 2016 installed on it, and the other is my new Virtio disk, whose sole purpose for existing is to give Windows a chance to install the Virtio storage drivers. Let’s go to the CD/DVD section. We now need to mount the ISO that we downloaded earlier as a new CD drive. Currently, the Windows Server 2016 installation ISO is still listed from my previous video. Let’s click the icon and navigate to the VM folder that’s on the QNAP. I’ll select the ISO file and hit OK. And then, Apply. Now we’re ready to start up the VM. I’ll tab over to Information, then click the main image to launch the VM viewer. I’ll go ahead and hit Start to turn on the machine. And as we boot up, let me start up the toaster oven… OK, let me shut down the Server Manager. You can see in my notification tray that I no longer have network access for the reasons I explained earlier. I’ll launch File Explorer, and verify that the Virtio driver CD has been mounted. It has a slew of drivers on it, as you can see. Next, I’ll visit the Control Panel, so I can show you the Device Manager. The Device Manager is where we’re going to install all of our Virtio drivers. You’ll notice that we’re missing some drivers for the new devices, including the Ethernet controller, a PCI device, and a SCSI controller. Let’s go down the list one by one. What you’ll want to do is right-click on Ethernet Controller, and choose Update Driver Software… then select the second option on the screen – Browse my computer for driver software – so you can specify the driver CD. Let’s click the Browse button and navigate to our CD drive, which in our case is the D
drive. Hit OK… then make sure you have the Include Subfolders checked, because we want it to traverse down into the subfolders to find the correct driver. Click Next. Looks like it found the driver, so hit Install, and then close the wizard. Once the Device Manager refreshes, we can see that the Virtio network driver was successfully installed. Now let’s do the same thing for the PCI device. Right-click on it… choose the second option… It’s already pointing to our D Drive, so we don’t have to change anything – and hit Next. After it’s done installing, click Close. This installs the Virtio balloon driver, which provides some neat memory management for your VM. Finally, let’s right-click the SCSI controller, browse for the driver, click Next… and close out of the dialog box. This final piece gives us the Virtio SCSI controller, as well as the Virtio disk device. Now we can exit the Device Manager, close out of Control Panel, and actually – we need to shut down the whole machine to make some final changes to the VM settings – so let’s exit Windows. Returning to the Virtualization Station, let’s head over to the Settings tab again. The Network section doesn’t need any change, since we’ve installed the Virtio drivers for our current adapter. However, in the Storage section, we need to change the interface of our main OS drive to Virtio – and get rid of our dummy drive, which I’ll do by clicking the X, and confirming OK. Let me also get rid of the hard drive image for this. And lastly, we
hit Apply for our change to take effect. Moving to the CD/DVD section, I’m going to unmount the driver installation CD (which I no longer need) by hitting the X again, and confirming OK. Now we can go back to the Information tab, and restart the VM. Let me Start the machine, then take another short break as it boots up… Now that we’re in, let’s verify our drivers. I’ll start the Control Panel to access the Device Manager… and as expected, we have our Virtio disk device and network adapter. I’m now going to run the benchmarks for the disk and network, so let’s close out of this, and Control Panel, and start Crystal DiskMark. I’ll start all tests using the default values again, then fade to black… And after a while, we get 133 MBps read, and 79 MBps write for the sequential test. I’ll run it two more times, and we see the numbers a little more varied than last time. I’ll take the last run as the representative score. Now, let’s compare this to our test before we installed the Virtio drivers. We see better read times across the board, doubling in the sequential test, though the write speeds are roughly the same. Just as a point of reference, I ran the test in a bare Windows environment, where I get around 160 MBps for the sequential test, using a similarly spec’ed Hitachi 3 TB drive running at 7200 rpm on a run-of-the-mill Intel i3 machine. So the Virtio drivers did help performance for read speeds. Next are the LAN speed tests. The first run gives me 160 Mbps up and 480 down. Running it a couple more times, I’m going to take the third run as my representative sample, and compare it to the pre-Virtio numbers. We see there’s roughly a 30% improvement in both upload and download speeds. Finally, let me transfer my 2 GB file to a network drive, and we see a transfer speed of about 75 MBps, which is double what we saw before Virtio. Of course, it’s slower than bare metal, where I can get 100 MBps. So, I hope this helps those of you installing VMs on Virtualization Station. With the exception of disk write speeds, I am seeing demonstrable improvements in disk and network speeds with the Virtio drivers over the emulation, but not as fast as in a bare Windows environment. And that’s to be expected – Virtio doesn’t give direct access to the physical devices, since it has to go through a layer to talk to the hardware. But in general, it’s definitely an improvement over the default emulated devices. I hope you enjoyed – thanks for watching!

20 Comments

  1. Please note that the website for the virtio driver has changed (at the 4:50 mark). It is now: https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html. Thanks to Fenghe Xe for the tip.

  2. Thanks for the tutorial! My CrystalDiskMark is getting 340 MB/s read but only 7 MB/s on the write, did you have this problem too? The only option that I changed in your tutorial is the HDD cache mode is writethrough instead of none. This was a mistake, though I can't reverse it without re-installing windows. I'm using a single Seagate 7200rpm/ 256mb 8TB hard drive.

    EDIT – I turned off writethrough mode and now my speeds are about 90mbs-110mbs read and similar write. Interesting how the cache mode can increase the read speed so much… more experimentation needed.

  3. After installing the VIRTIO drivers, and shutting down and changing storage from IDE to viRTIO , upon starting it doesnt load 🙁

  4. Great tutorial! Happy I found it. Keep up the great work with the QNAP series of videos its really appreciated.

  5. Great videos. I just discovered you and you have been a great help. However I am still in need of help with the VM. I have Qnap TS-877 with 5 WD Red Pro 6 TB drives. I use the VM for Win 10 to host our accounting software and the VM is horribly slow. However the disk benches are great, before Virtio: seq read 145mb, Seq write 76mb, after your tutorial: seq read 309mb and seq writes 67mb. But why is the responsiveness of the VM like a Win 98 machine. During your video your clicks and apps opening were really fast, mine is like a turtle, It literally takes about 45 seconds to type Device Manager into the search tab, and another minute or so to open it up. Please help!

  6. they changed the virtio download url https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html

  7. I've tried installing virtio drivers but after changing the setting on qnap virtual station from sata to virtio Win10 crashed on boot. Any way to make system boot with virtio hard selected on VM settings? (Virtio drivers are installed in Win10)

  8. Hi, once again thank you so much for a great video. Your voice is so soothing you should work as a dubber… 🙂 By the way: The hard drive speed in my Windows-VM jumped from 15 MB/s to 113 MB/s on my QNAP TVS 872 XT with VirtIO drivers, it's factor seven! Frickin unbelievable! And I did not need to update the drivers in the device manager manually after firing up the VM. Windows 10 Pro does this while booting up, when the ISO/CD/DVD is connected.

  9. Very important in addition to all the great tips here: If you're already using two IDE-based harddisks like c: (Boot) and d: (Data) in your Windows 10 VM you will probably get an error message like "No bootable device found" after switching the interface on c: to "VirtIO". d: works like a charm but your boot device will stuck with the "IDE"-interface no matter what. The solution is very simple: Shutdown your virtual machine. Go to your Windows-VM-"Settings". Click "Storage". Delete all hard disks – not the hard disk image itself! – except for the boot hard disk (c:). Now change the interface from the boot hard disk to "VirtIO". Boot your virtual machine. This should work without an issue. Shut down your VM. Go to "Settings" and "Storage" again – and "Add device". Add your hard disk image (d:) and set the interface to "VirtIO". Done! No Windows re-installation, no fiddling with drivers…

Leave a Reply

Your email address will not be published. Required fields are marked *