You are not logged in.

#1 2014-11-21 12:06:18

Lockheed
Member
Registered: 2010-03-16
Posts: 1,543

VirtualBox massively outperforming KVM - why?

I wanted to see what would be the best performing (for my needs) virtualisation solution. I kept reading KVM outperforms VirtualBox, so I installed KVM and gave it a try. However, the guest system seems sluggish compared to VirtualBox so... I compared the two.

Host:
Core2Duo 2.5GHz, 8GB RAM, SSD
3.18 kernel, latest VirtualBox

On each VM I:
- installed the same fresh XP 32bit system
- installed appropriate guest additions
- I did NOT enable 2D acceleration on VBox, and I DID select QXL graphics on KVM (so if anything, VBox got a shorter end of the stick here)
- run Passmark benchmark.


Here are my findings:

KVM / VirtualBox

CPU Mark 1147 / 761
2D Graphic Mark 70.3 / 307.9
Memory Mark 434.4 /  371.1
Disk Mark 290.7 / 993

------------------------------------------
Overall passmark rating 298.7 / 463.4
------------------------------------------

Samba Sequential Read: 6.3 / 84.5
Samba Sequential Write: 11 / 40.1
Samba Random Seek + RW: 2.54 / 44

So it appears that apart from CPU and Memory Mark (in which KVM edges in front of Vbox) VirtualBox simply obliterates KVM. And just look at Samba share performance where KVM does just absurdly bad.

I am quite surprised native KVM virtualisation compares that badly to VirtualBox. There either is something very wrong with KVM, or it just can't run Windows guests properly.

Any comments welcome.

Offline

#2 2014-11-21 13:46:30

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,364

Re: VirtualBox massively outperforming KVM - why?

here either is something very wrong with KVM, or it just can't run Windows guests properly.

none of the above.


you just need to tweak KVM configuration, default it makes several 'safe' choices that almost always work, but are slow.

Check the qemu wiki page, especially tips & tricks esction.

Last edited by Lone_Wolf (2014-11-21 13:47:24)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2014-11-21 13:55:09

Lockheed
Member
Registered: 2010-03-16
Posts: 1,543

Re: VirtualBox massively outperforming KVM - why?

I can see there no more optimisation I could introduce to make KVM any faster. I am already using QXL video drivers and I have Spice guest additions installed. Also, I am using virsh and virt-viewer, not qemu itself.

Offline

#4 2014-11-21 14:16:20

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,364

Re: VirtualBox massively outperforming KVM - why?

Also, I am using virsh and virt-viewer, not qemu itself.

virsh & virt-viewer are mainly frontends for qemu, do you know what configuration they set ?

Do they use TAP networking (tends to give native network speeds) or user networking ?

is host type and acceleration set correctly by them ?

do virtualbox and your kvm virtual machine even have the same memory amount available ?

here is an example of the start command i use :

#!/bin/bash
qemu-system-x86_64 \
-machine type=pc,accel=kvm \
-cpu host \
-boot order=d  \
-drive file=~/Virtual_Machines/arch-test/arch-test,if=virtio \
-cdrom ~/Documents/Images/archlinux-2012.12.01-dual.iso \
-net bridge,br=br0 -net nic,model=virtio \
-vga vmware \
-m 2048

It's been over a year since i did graphics performance testing , but these were my findings :

best -   rdp --nographic (see windows specific notes on qemu page) .
2nd vga-vmware
.......
3rd vga-std & qxl


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2014-11-21 14:52:08

Pse
Member
Registered: 2008-03-15
Posts: 415

Re: VirtualBox massively outperforming KVM - why?

For starters you could see what disk options you are using. qcow2 devices are slow. Check cache and io mode settings in virt-manager for each disk. Use a VirtIO drivers in Windows XP.

Offline

#6 2014-11-21 16:04:02

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: VirtualBox massively outperforming KVM - why?

@Pse: qcow2 is an image format, not a device type, and can be used with VirtIO bus. A qcow2 image could become slow due to fs fragmentation and perhaps snapshots, but I don't think it's inherently slow.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#7 2014-11-21 16:45:47

Potomac
Member
Registered: 2011-12-25
Posts: 542

Re: VirtualBox massively outperforming KVM - why?

my settings for an archlinux guest with qemu :

#!/bin/sh

qemu-system-x86_64  \
-usbdevice tablet -k fr \
-m 1024 \
-netdev user,id=vmnic,hostname=arch-qemu -device virtio-net,netdev=vmnic \
-cpu host -enable-kvm  -machine type=pc,accel=kvm -smp 2 \
-soundhw ac97 \
-vga vmware \
-boot order=c -drive  file="/mnt/vms/arch linux/archlinux.qcow2",if=virtio \
-daemonize -monitor telnet:127.0.0.1:12997,server,nowait,ipv4

you can also use spice driver but there are some bugs with spice and archlinux guest :

#!/bin/sh

export SPICE_PORT=5924
export QEMU_AUDIO_DRV=alsa 

qemu-system-x86_64 \
-usbdevice tablet -k fr \
-m 1024 \
-netdev user,id=vmnic,hostname=arch-qemu -device virtio-net,netdev=vmnic \
-cpu host -enable-kvm  -machine type=pc,accel=kvm -smp 2 \
-soundhw ac97 \
-vga  qxl -spice port=5930,disable-ticketing \
-boot order=c -drive  file="/mnt/vms/arch linux/archlinux.qcow2",if=virtio \
-daemonize -monitor telnet:127.0.0.1:12997,server,nowait,ipv4 \
-device virtio-serial-pci -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 -chardev spicevmc,id=spicechannel0,name=vdagent

spicec -h 127.0.0.1 -p 5930 --hotkeys release-cursor=ctrl+alt

performances are best with spice if I use a windows guest ( windows 7 )

Last edited by Potomac (2014-11-21 16:52:21)

Offline

#8 2014-11-21 21:34:42

Lockheed
Member
Registered: 2010-03-16
Posts: 1,543

Re: VirtualBox massively outperforming KVM - why?

Al-right. Thanks guys. I will play around with various settings.

I tried running the RDP as per QEMU Arch wiki:

qemu-system-i386 \
-machine type=pc,accel=kvm \
-cpu host \
-drive file="/home/user/VirtualBox VMs/gnome.boxes_images/boxes-unknown",if=ide \
-drive file=fake.qcow2,if=virtio \
-cdrom /mnt/Disk_D/ISOs/Windows/virtio-win-0.1-81.iso \
-net nic,model=virtio \
-nographic -net user,hostfwd=tcp::5555-:3389
-m 2048

and then connect with

$ xfreerdp -g 1600x1200 localhost:5555 -z -x lan

FreeRDP - A Free Remote Desktop Protocol Implementation
See www.freerdp.com for more information

Usage: xfreerdp [file] [options] [/v:<server>[:port]]

Syntax:
    /flag (enables flag)
    /option:<value> (specifies option with value)
...

but as you can see, xfreerdp doesn't even accept the parameters - just shows the help. However, spide does work and it seems promising.


By the way - on a 64bit Arch host, is it better to run 32bit or 64bit Windows if it won't get more than 3GB RAM just for itself?

Last edited by Lockheed (2014-11-21 22:15:09)

Offline

#9 2014-11-22 16:15:36

Pse
Member
Registered: 2008-03-15
Posts: 415

Re: VirtualBox massively outperforming KVM - why?

alphaniner wrote:

@Pse: qcow2 is an image format, not a device type, and can be used with VirtIO bus. A qcow2 image could become slow due to fs fragmentation and perhaps snapshots, but I don't think it's inherently slow.

IME, on slow rotational media (5400 RPM drives), qcow2 is terribly slow compared to RAW images. In fact, according to my tests (I use many VMs), RAW on Btrfs with COW and snapshots is much faster than qcow2 on Ext4 or XFS. A SSD probably makes a big difference, but I haven't run my tests on it.

Offline

#10 2014-11-22 20:24:31

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,446

Re: VirtualBox massively outperforming KVM - why?

Does your cpu support vt-x?
If not, then it is perfectly normal that qemu is slower than virtualbox.


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

Board footer

Powered by FluxBB