Saturday, July 26, 2008

(K)QEMU speed tests

QEMU without additional accelerators is very slow, and that is a well known fact. If you have a modern processor with virtualization options you will most probably want to use KVM. You can find out if your system can run KVM by checking the flags line in /proc/cpuinfo for vmx (Intel) or svm (AMD).

$ grep -E '^flags.*(vmx|svm)' /proc/cpu

Unfortunately my CPU doesn't have such options. I have one of those Core2Duo processors that lacks suck features (T5500, commonly used on laptops). So if you're in situation like me, you're stuck with KQEMU to speed the things up. Up to yesterday, I was not fully aware what is the performance penalty of not using one of the accelerators. I've made some tests of my own to see how virtual machine behave with and without accelerator module.

Tests were run on Debian GNU Linux (lenny), kernel 2.6.25 and with QEMU version 0.9.1. Underlying hardware was IBM Thinkpad R60e, Core2Duo 2x1.66 GHz with 1 GB of RAM. For testing purposes I've used guest with Red Hat Enterprise Linux 5.1. Tests were focused on three areas I was most interested in:
  1. Processing speed, calculate as many RSA public/private keys as possible in 10 sec (openssl speed rsa4096)
  2. Network speed, download 10 MB file with wget (wget URL)
  3. Disk speed (hdparm -tT)
First, each of tests was run on host OS (Debian), then in virtual machine without KQEMU and finally in virtual machine with KQEMU module loaded. The results are:

Calculation of RSA public keys (10 sec)
Host OS: 7202
KQEMU: 6188
QEMU: 372

Calculation of RSA private keys (10 sec)
Host OS: 98
KQEMU: 85
QEMU: 6

Buffered disk I/O
Host OS: 33.51
KQEMU: 24.51
QEMU: 25.47

Cached disk I/O
Host OS: 918.97
KQEMU: 442.71
QEMU: 445

Network I/O (download of 10 MB file)
Host OS: 52
KQEMU: 53
QEMU: 51

While virtual machine I/O performance was pretty much the same in both cases (slightly better without accelerator module), number crunching tasks like RSA key pairs generation is where KQEMU shows up. KQEMU accelerated guest achieves at most 90% of host speed, but without accelerator only about 10% which is very slow. Tests also show that disk performance on guests is around 50% of that on host.

Next thing I want to check is VirtualBox performance. I expect it to be slightly better of that of KQEMU. Unfortunately there is no Xen enabled kernel in Debian packages for lenny so I can test Xen performance.

0 comments: