Wednesday, July 20, 2016

Vagrant 1.8.5 and VirtualBox 5.1 Networking Performance

I’m not trying to make this a Vagrant/VirtualBox blog, but as they are currently tools I use almost continuously so new versions, features, and tips to increase their performance are obviously of great interest.

With Vagrant 1.8.5 released Monday and now supporting VirtualBox 5.1, I’ve had some time to conduct a few informal network performance tests. The good news is that network performance with the Virtio Paravirtulized driver appears to be even better, an informal test showed 471Mbits/s versus the previous 361Mbits/s of VirtualBox 5.0.24 – same hardware, both using Xenial.

Additionally, to enable Virtio I’ve also come across an even either method through Vagrant. Simply add the following like to your Vagrantfile inside the VirtualBox provider block:
vb.customize ["modifyvm", :id, "--nictype1", "virtio" ]

Thursday, July 14, 2016

VirtualBox 5.1 released - but Vagrant 1.8.4 doesn't support it

UPDATE 7/19/2016: Vagrant 1.8.5 has been released with VirtualBox 5.1 support and other fixes (changelog).

VirtualBox 5.1 was released on Tuesday with several improvements/fixes that *I’m* eager to try out given I use a Windows Host with Linux Guests:
  • The new APIC and I/O APIC improvements, which I hope will continue to increase network performance.
  • Use of x2APIC for Linux guests and many other related fixes
  • No longer relies on DKMS for Linux guest kernel module rebuilding – I haven’t had the opportunity yet to dig into exactly what this entails, but I am excited by the possibility as at least in RHEL/CentOS, DKMS not available by default, although it is in EPEL.
  • The new NVMHCI-compatible storage controller
One major note though, Vagrant 1.8.4 does NOT support VirtualBox 5.1.  The good news is this should be coming soon as support was committed to the Vagrant master source on Wednesday. Let’s hope for the next Vagrant release soon!

Wednesday, July 6, 2016

Virtio Para-virtualized Network Driver with VirtualBox

UPDATE 7/20/2016: I recommend you also read my more recent Vagrant 1.8.5 and VirtualBox 5.1 Networking Performance post with update network performance numbers from VirtualBox 5.1 and a better method to enable Virtio with Vagrant/VirtualBox.

While traditionally emulators, including VirtualBox, have utilized emulated hardware devices today there is another option. Modern Linux kernels (>= 2.6.25 unless your distro backported it) support para-virtualized network devices drivers which are optimized for use in an emulated guest. This avoids much of the performance loss and other compatibility problems with emulating hardware devices. To illustrate the advantages here are some quick iperf numbers from a Xenial image running under Windows 10 in VirtualBox 5.0.24
  • Intel 1000 Pro MT Server: 236 Mbits/sec
  • Virtio Paravirtualized Network: 361 Mbits/sec
Anecdotally the performance of the Virtio driver also appears more consistent with the hardware emulation mode sometimes "hiccupping", and lower general cpu utilization.

Using the Virtio Para-virtualized Network Driver

Utilizing the Virtio Para-virtualized network driver is quick and easy in the current version of VirtualBox.
  • Confirm your Linux guest are configured to use the KVM paravirtualization provider – this should be the default in recent VirtualBox versions. This also enabled paravirtualized clocks and SMP spinlocks.
  • Change your network adapter type to ‘Paravirtualized Network (virtio-net)’.

  • Reboot and your Linux guest will automatically use the new driver. To confirm ‘lspci’ should now show your network card as ‘Ethernet controller: Red Hat, Inc Virtio network device’.
For more information about the Virtio driver, or VirtualBox networking in general, please see the Chapter 6. Virtual networking of the VirtualBox User Manual.