Category Archives: Igalia

Comparing virtualization software performance: QEMU vs UML vs KVM

I have been making some quick tests comparing the performance of some different popular virtualization programs.

This test is far from perfect but I think that at least you can get a basic idea of how all these virtualization techniques perform.

The test
The test was very simple: unpacking the source code of Linux 2.6.21.1 (from a .tar.bz2) and compiling it. I know it’s not an elaborate test but at least it involves both computation and I/O so the results shold be fairly realistic.

All the tools used were the ones that come with Debian 4.0 etch x86 (not x86_64): gcc 4.1, bzip2 1.0.3, etc. The filesystem used was ext3.

The host and the guests used basically the same software.

The host
I first compiled the kernel in the host:

  • Intel Core 2 Duo E6300
  • 1 GB RAM
  • Debian GNU/Linux 4.0 (etch)
  • Linux 2.6.21.1

As the machine has a dual-core processor I compiled the same kernel twice: first with a classic make and then with two simultaneous jobs (‘make -j2‘).

The guests
Besides compiling the kernel in the host I tested the following virtualization software:

  • User-mode Linux 2.6.17.13 in skas0 mode
  • User-mode Linux 2.6.17.13 in skas3 (v9-pre9) mode
  • QEMU 0.8.2
  • QEMU 0.8.2 using KQEMU 1.3.0-pre11
  • KVM 28

The results
Here are the results of the test ordered by total compilation time (best results are shown first).

Mode Time
Native (-j2) 4m 49s
Native 8m 38s
KVM 11m 12s
UML skas3 12m 47s
UML skas0 14m 30s
QEMU + KQEMU 17m 55s
QEMU 2h 13m 04s

Here’s a couple of charts showing the results. Both were constructed using the same data, but the latter omits QEMU as its performance is not comparable to the others. Click on the images to enlarge them.

Chart 1 Chart 2

Conclusions
As expected, native compilation is the best and making use of both cpu cores is really worth it.

KVM performed a bit worse than I expected but it’s still faster than any of the the other ones and reasonably close to native compilation.

Regarding User-mode Linux I was a bit surprised that the skas0 mode did not perform much worse than the skas3 mode. I also expected KQEMU to perform a bit better… unlike KVM, this one is even slower than plain User-mode linux running in skas0 mode (that doesn’t require any kernel module nor patch). Of course they’re very different programs, but you get what I mean.

And last but not least, I was really amazed on how slow is QEMU with no helper module. Of course in this mode (and unlike the other solutions tested) it emulates the CPU so it has to be obviously an order of magnitude slower than the rest, but still in everyday,
interactive usage, it doesn’t feel that slow.

Some extra remarks that I’d like to point out:

  • Native mode is the only one that benefits from parallel compilation. All the other virtualization solutions perform (as expected) a bit slower when compiling with -j2. QEMU and KVM have a -smp flag to emulate a machine with several CPUs but neither one boots properly with that flag enabled.
  • I made some tests comparing QEMU performance with qcow and raw disk images. The results were more or less similar.
  • KQEMU didn’t even boot if I tried to use the -kernel-kqemu flag
  • KVM requires hardware support to work properly. Only recent processors have this kind of functionality (mine has) so it doesn’t make sense to use it if your processor is older.
  • Of course there are many other virtualization programs that I did not use in this test: OpenVZ, Xen, Linux-VServer, VirtualBox, VMWare… I expect OpenVZ and Linux-VServer to perform more or less like native mode, but I’d really like to know about the other ones.

And that’s all!! I hope that this article is useful to anyone and of course comments are welcome.

Back from Primavera Sound 2007

I’ve had a great time in Primavera Sound 2007. It was a really good festival and -despite some flaws this year- very well organised.

Primavera Sound 2007

This time more than 100 artists and bands played in the festival so it’s really hard to summarize everything in a few lines. Some of my favourite concerts were (in no particular order): Wilco, Spiritualized, Billy Bragg, Sonic Youth, The Durutti Column and Malajube.

Lots of pictures and videos are already available out there.

And now, back again at work!

Finally: Last.fm again in Debian!

I’m glad to announce that, after some months of unofficial packages, John Stamp is now the official Debian maintainer of the Last.fm client.

You can find his packages in the official Debian and Ubuntu repositories. So if you’re using the development version of either distribution you can forget about this page and install this software using apt-get.

However, as many people are using etch, feisty, or some previous version of Debian or Ubuntu, I’ll keep compiling backports of John’s packages for these distributions, at least for some time.

You can get them from my home page, as usually.

The Firefox Mozex plugin

As time passes more and more applications are web-based. The World Wide Web has switched from being a place where you basically see static data to a place where everything is interactive.

Good examples of this are wikis and weblogs: two of the most remarkable kinds of applications that have appeared in recent years and can be used with nothing more than a web browser. Web applications are nice as they allow you to do the same job no matter where you are: at home, at work, at an internet cafe, at a friend’s house, …

One of the biggest problems of this is that a web browser is not really suited for all kinds of tasks. Example: a wiki is a great tool because you can edit a page very quickly, but the browser itself is a crappy editor. It lets you do very basic things besides moving around with the cursor keys, cutting and pasting text.

A great solution for this problem is Mozex, a Firefox extension that lets you use external programs for some of the actions that you normally do with the browser, including the editing of text areas. You just press a key combination and a text editor pops up with the text of the area that you have selected. Very easy to use.

Here’s an example of my browser editing the Wikipedia using my favourite text editor (click on the image):

Mozext example

A great tool. I’m sure you’ll like it 😉

DudesConf and Last.fm update

We had a great time last weekend at DudesConf. We met a lot of Debian people from all parts of Spain (and some non-Spaniards too) and had some interesting talks and BOFs. Check Mario’s report and don’t miss our photo with Steve Langasek!

As usual, John has been doing the hard work and has updated the Debian diff for the Last.fm client.

I have been very busy these days so I had no time to release the packages until today. These are the news:

  • Added Turkish translation.
  • Added a patch to prevent text relocations. Users of 64-bit architectures should benefit from this.
  • I’ve compiled a new package for Ubuntu Feisty (although the one for Edgy should work as well).

You can get the packages here.

QEMU in five minutes

Some friends have been asking me how to use QEMU. While there are many other virtualization packages (such as Virtual Box, KVM or the non-free VMware Player), QEMU has been around for a while, it’s already packaged in Debian stable and it’s really easy to use.

Moreover, the (optional) kernel accelerator kqemu has been released under the GPL a couple of months ago, so it’s a good moment to give QEMU a try.

Let’s see the basic usage:

  • Install QEMU.
    $ apt-get install qemu
  • Create a hard disk image. It’s 2 GB in this example, but don’t worry about the size of the file, it will grow dinamically as you write data to it.
    $ qemu-img create -f qcow hd.img 2G
  • Install things in your new hard disk image. You can boot from a CD-ROM, or an ISO image, a floppy…
    $ qemu -hda hd.img -cdrom /dev/cdrom -boot d
    $ qemu -hda hd.img -cdrom cdimage.iso -boot d
    $ qemu -hda hd.img -fda /dev/fd0 -boot a
    $ qemu -hda hd.img -fda floppy.img -boot a
  • Once the system is installed in your virtual hard disk, you can boot directly from it:
    $ qemu -hda hd.img
  • Or you can forget about hard disks and just use a bootable CD:
    $ qemu -cdrom livecd.iso

And that’s it! QEMU has built-in SMB, TFTP, DNS and DHCP servers. Everything in user space, so you don’t need special permissions nor additional configuration: no kernel modules, no tun/tap interfaces… nothing!. I said it was very easy to use, didn’t I? 😉

Of course there’s a lot more, but you won’t need it for the basic usage.

If you’re too lazy to install an operating system inside QEMU, you can download a hard disk image built by someone else. Note that QEMU can read the VMware disk format, so you’ve got a really big collection of images ready to work.

And if you want a bit more, you can compile the kqemu kernel accelerator, which will make QEMU run faster.

Now I can remember the old times when I first installed Debian…
Debian bo inside QEMU