Wednesday, April 8, 2015

High Performance Desktop Virtualization Alternative to VirtualBox? Paravirtualized KVM with Spice, VirtManager 1.0.1 and Remmina-Next

I was a long term user of Virtualbox. Totally impressed by its easy to use GUI and the features exposed. It’s a perfect tool for a novice to start with virtualization. Below are the most useful features (exposed in the GUI), that I value most.

VirtualBox Best Features:

1. Guest Additions

Guest Additions improves 2D performance, Clipboard sharing and seamless integrations to name a few.

2. Snapshots

Snapshotting your virtual machine, so that you can restore it back in the future, when something go wrong.

VirtualBox Disadvantages:

But regarding the performance perspective, VirtualBox lags a lot compared to KVM, a Bare Metal native hypervisor for Linux environments. I’ve experienced the performance issues most with the below scenarios.

a. Opening Multiple performance intensive applications at once, inside a single VM.

b. Running 2 or more VM’s at the same time

In these scenarios, Virtualbox truly lags and freezes for a couple of minutes. Its GUI become unresponsive until the applications get settled.

So Virtualbox can be suffice for a beginner, but not suitable for a hard core virtualization user.

Introducing KVM:

With KVM, we’ve faced no such performance issues in the above scenarios. And that too in a machine powered by a Pentium Dual Core Processor with only 4GB of RAM. In other words KVM is the best for, such performance intensive workloads. It especially scales well with more than two VM’s and performance intensive applications inside a single VM.

Clearly KVM is the best, high performing choice for any Desktop virtualization purpose, that involves heavy workloads.

But KVM is known to be suited best for Servers. Not for desktops. Why? Many argues about this, as they says, only command line management tools are available for KVM and the GUI management tools provided are so rudimentary, that lack crucial features.

The adoption of any desktop virtualization suite, largely depend on the GUI Management features, as the audience involves are less experienced end users. Can we make KVM, user friendly, similar to VirtualBox with similar GUI management features? Yes we can!

I’ve listed the below sections, that can make KVM a high performing desktop virtualization alternative to VirtualBox.

Note: I’m detailing the procedures in the context of a Host machine, with Ubuntu 14.04 LTS installed. The steps will be similar, for other versions of Ubuntu as well.

Guest Additions with KVM (Para Virtualization with KVM)

To get the maximum performance out of a VM (running under KVM), you’ve to Para virtualize it.

To know more about Para virtualization, read this article. i.e You can make the VM’s disk, network, memory management and display controllers aware about the underlying virtualization environment, on which they are running and hence their behavior can be optimized for virtualization to achieve higher performance.

Now make your virtualized guest devices (Network/Disk/Memory/Display) as Para Virtualized (VirtIO/Spice) through Virt-Manager GUI. This has been explained nicely in this article and install the associated Para Virtualized drivers.

For KVM based windows guests, all these Para virtualized drivers are available as a single package in the Spice portal. Download Splice Guest Tools, and install under a windows guest. This will work for windows guests, that will be running Windows7 or lower.

If your Windows Guest, runs Windows8 and higher, the above package will not work, as the QXL video driver is not supported for Windows8 or higher (Windows8 and higher now use WDDM driver model for display driver, which is different from the Spice QXL Video driver). Nevertheless you can install Para virtualized drivers (Other than QXL display driver) in windows8 and higher. You can download the ISO file from the Fedora repository, that contains the Network, disk and memory management drivers. Manually install these drivers on your guest.

For Linux guests, follow this link. Recent versions of Debian and Ubuntu distributions have these Para Virtualized drivers out of the box.

Now we’re on par with Virtual Box Guest additions.

Note: If you get the error (“Cannot display graphical console type 'spice': No module named SpiceClientGtk”) in Ubuntu, while starting the VM, just install the module ‘python-spice-client-gtk’ through apt-get.  i.e ‘sudo apt-get install python-spice-client-gtk’. This bug has been filed in lauchpad.

Add Snapshot Capability in GUI, for KVM (Upgrade Virt-Manager to 1.0):

The current version of VirtManager (Included in Ubuntu14.04 LTS) is 0.9.5. This version lacks the most valuable feature compared to VirtualBox GUI, which is the “Snapshot Feature”. This is the most required feature under virtualization.

Luckily VirtManager.1.0.1 have this feature, but does not included under Ubuntu 14.04. You’ve to follow the below to install VirtManager.1.0.1 under Ubuntu 14.04.

wget -q -O - | sudo apt-key add -

sudo sh -c 'echo "deb trusty-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'

sudo apt-get update

sudo apt-get install virt-manager

Note: This is for Ubuntu14.04. For other versions, you’ve use the corresponding repository name as mentioned here.

VirtManager.1.0.1 having the support for ‘Internal Snapshots’ (Available only with Qcow2 disk images). Note: It does not support ‘External Snapshots’


Now we’ve the ‘Snapshot’ capability from UI, as that of VirtualBox.

Add Quality 2D display experience  for Windows8+ KVM Guests (Upgrade RDP-Software)

As we already seen, Windows8+ will not support Spice QXL driver and hence we’ve to still fallback to the VNC protocol for display, which having very terrible UI experience compared to VirtualBox 2D.

A good alternative is to leave the VirtManager VNC viewer, and just use a RDP client application to the Guest (That is running Windows8+). The best option so far is to install ‘Remmina’, the best RDP client in Linux environment.

As with VirtManger in Ubuntu14.04, The version of 'Remmina’ included with Ubuntu14.04 is quite outdated (1.0). This version having serious bugs like ‘No ClearType/Font Smoothing’ support, ‘Unable to change Mouse ICON in RDP’ e.t.c.

All these items have been fixed in ‘Remmina.1.1 and 1.2’, which can be installed by following the below in Ubuntu14.04.

sudo apt-get remove remmina

sudo apt-get autoclean

sudo apt-get autoremove

sudo apt-get clean

sudo add-apt-repository ppa:remmina-ppa-team/remmina-next

sudo apt-get update

sudo apt-get install remmina


The RDP experience with Remmina-Next is very smooth, it support ClearType and Mouse Themes as that of the RDPed machine.

Unparalleled Performance:

Now with these steps, the KVM will be unparalleled in performance as a Desktop Virtualization Suite.

1 comment:

  1. To install KVM Guest Additions (Para Virtualization) on ubuntu guests use below commands:

    $ sudo apt-get install spice-vdagent

    Now edit the below file, to enable Virtio Drivers. Put 'Y' for below settings.

    $ sudo leafpad "/boot/config-`uname -r`"