10

I've noticed several articles that have claimed that QEMU is slower than VirtualBox (without hardware assistance) but several are years old, and the newest seemed to be from last year.

  • Is it true that QEMU is slower than VirtualBox?
  • If so why?
  • Are there any tricks to close the performance gap?

Some of my host systems do not have hardware virtualization support so I'm especially interested in performance tips that work without the kernel module.

2 Answers 2

11

If you're talking about x86 virtualization on an x86 host, be advised that kqemu (the old acceleration kernel module for qemu) is deprecated. Kernel Virtual Machine (KVM) is "the way forward" but it only works on Linux hosts. The guest can be whatever OS you want as long as it's x86 architecture.

Cross-architecture, qemu is still really slow; just today I was trying latest qemu with Debian MIPS64 in the guest.... it was usable from a terminal but horribly slow in Xorg. to the best of my knowledge, you can't use processor acceleration instructions like extended page tables or VT-x when you're going cross-architecture. It's all emulated in software.

So for x86 to x86 virtualization, "raw" qemu is slow, but KVM (which uses qemu) is fast. Quite fast. So fast that it's Red Hat's recommended virtualization solution for RHEL.

VirtualBox still blows away anything qemu/kvm can offer in terms of hardware-accelerated 2d/3d graphics performance, because kvm focuses on server virtualization and virtualbox focuses on desktop virtualization. But I'd definitely recommend that you check out kvm if you dealing with a server.

Edit: For your hosts that don't have any hardware acceleration, you're going to suffer from a pretty large overhead regardless of which virt solution you use. Emulating hardware things in software is hard, and expensive.

7
  • 2
    ls $(which kvm) shows a symlink to qemu-system-x86_64. I'm guessing that's exactly what you were talking about with KVM using QEMU?
    – Catskul
    Jul 10, 2012 at 21:21
  • Yes, but KVM is, as the name implies, a kernel based virtual machine, which means that the hypervisor guts are in the kernel module 'kvm'. You can think of it as being similar to the old kqemu if you want, but architecturally it's very different. qemu is more of a frontend than an actual hypervisor when kvm is in operation. Jul 10, 2012 at 21:30
  • Oh, I forgot to add: the reason why qemu (and any other virtualization system) is so slow without a "kernel module" (as you say; what you really mean is "without hardware acceleration") is that certain hardware operations that the guest performs are very hard to emulate in software. Well, not hard in terms of unreliable or complicated; just sloooooooooooooow. That's why Intel spent the better part of a decade giving us hardware-accelerated instructions for the slowest bits of virtualization in the way of VT-x and EPT. The only fix is to use hardware that supports these instruction sets. Jul 10, 2012 at 21:33
  • Is there something that makes virtualbox faster even without hardware acceleration?
    – Catskul
    Jul 18, 2012 at 15:11
  • No. Without hardware acceleration, the performance should be fairly equal. VirtualBox may have advanced x86 optimizations that make it run slightly faster in software, which would be appropriate since virtualbox only supports x86 in the first place, while qemu has a much broader playing field (non-x86 architectures). But this is an implementation/design detail that would basically come down to cache locality, optimized inner loops, hand-coded assembler, host-side disk I/O caching or other tricks. Not sure to what extent vbox does these things that qemu doesn't but they aren't very relevant... Jul 18, 2012 at 18:51
1

Assuming a host with a virtualization-capable CPU (Intel VT-x, AMD SVM), running Qemu on a kernel (Linux with KVM), it is reasonably fast.

The technical reasons for Qemu being slow with 2D (youtube, spreadsheet, games) and 3D emulation are obscure to me. However, I can make a guess that the "video drivers" simply aren't good enough - the graphics hardware in the hardware is not used in an optimal way.

On the bright side, a recent development introduced the SPICE framework to qemu. Actually it is a few years old and seems reasonably mature. The video-performance benefits of running with the QXL video driver are huge in my experience (2D web-development). I don't know how well it compares to Virtualbox, but it's definitely an improvement. I think SPICE is a must have for anyone running Windows in Qemu.

This is solely my opinion and It should be noted that I have never even tried to run any 3D or video playback in the guest.

2
  • 1
    If by "graphics-oriented emulation" you refer to 3D acceleration, it's because GPUs can't be virtualized like CPUs. Software emulation is impossibly slow, so there are nowadays two solutions: 1. API passthrough (ie. DirectX calls in the guest are executed as DirectX calls on the host) 2. VGA passthrough (the real deal: the entire graphic card is made available to the guest). QEMU supports #2.
    – Marcus
    Aug 7, 2016 at 22:03
  • @Marcus Passthrough is the way to go. Aug 9, 2016 at 8:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .