All of lore.kernel.org
 help / color / mirror / Atom feed
* Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
@ 2011-02-14 18:15 Thomas Broda
  2011-02-15  9:19 ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Broda @ 2011-02-14 18:15 UTC (permalink / raw)
  To: kvm

Hi,

I've set up a KVM hypervisor for testing purposes. It's running on an 
AMD Quad-Core Phenom with a local RAID5 which is made of three disks 
connected to a hardware RAID controller. On top of this, there an LVM 
volume.

dd'ing /dev/zero to a testfile gives me a throughput of about 400MB/s 
when done directly on the hypervisor. If I try this from within a 
virtual guest, it's only 19MB/s to 24MB/s if the guest is on the LVM 
volume (raw device, not qcow2 or something, no filesystem on top of the 
LVM).

Even if I place the guest on an iSCSI target on my desktop PC (which 
has one cheap SATA drive only), I get a write throughput of about 
50MB/s to 60MB/s from within the virtual machine. What could be the 
reason for the slow disk IO if the guests are stored locally on the 
hypervisor?


The setup is as follows:

1. Package versions:

kvm-qemu-img-83-164.el5_5.25
kmod-kvm-83-164.el5_5.25
kvm-83-164.el5_5.25
libvirt-0.6.3-33.el5_5.3

2. Hypervisor kernel version: 2.6.18-194.32.1.el5

3. kvm_amd is loaded on the hypervisor, and the virtio stuff is loaded 
on the guest:

virtio_net             47425  0
virtio_balloon         39877  0
virtio_blk             41417  3
virtio_pci             41417  0
virtio_ring            37441  1 virtio_pci
virtio                 39365  4 
virtio_net,virtio_balloon,virtio_blk,virtio_pci

4. Guest has been installed as follows:

virt-install --name spacewalk --vcpus 4 -r 2048 -u `uuidgen` --os-type 
linux --os-variant virtio26 -b kvmbr0 -v --accelerate -c 
/root/CentOS-5.5-x86_64-netinstall.iso --disk 
path=/dev/vg0/lvspace,bus=virtio,sparse=false

5. Guest XML dump:

<domain type='kvm' id='11'>
  <name>spacewalk</name>
  <uuid>a6e2b1f7-d3eb-4e91-a1db-4e248a395b25</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>4</vcpu>
  <os>
    <type arch='x86_64' machine='rhel5.4.0'>hvm</type>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' cache='none'/>
      <source dev='/dev/vg0/lvspace'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='/root/CentOS-5.5-x86_64-netinstall.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
    </disk>
    <interface type='bridge'>
      <mac address='54:52:00:13:cf:58'/>
      <source bridge='kvmbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0' 
keymap='de'/>
  </devices>
</domain>


Thanks in advance,

--
Thomas


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
  2011-02-14 18:15 Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor Thomas Broda
@ 2011-02-15  9:19 ` Stefan Hajnoczi
  2011-02-15 10:15   ` Thomas Broda
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2011-02-15  9:19 UTC (permalink / raw)
  To: Thomas Broda; +Cc: kvm

On Mon, Feb 14, 2011 at 6:15 PM, Thomas Broda <thomas@bassfimass.de> wrote:
> dd'ing /dev/zero to a testfile gives me a throughput of about 400MB/s when
> done directly on the hypervisor. If I try this from within a virtual guest,
> it's only 19MB/s to 24MB/s if the guest is on the LVM volume (raw device,
> not qcow2 or something, no filesystem on top of the LVM).

Did you run dd with O_DIRECT?

dd if=/dev/zero of=<path-to-device> oflag=direct bs=64k

In order to exercise the disk and eliminate page cache effects you
need to do this.

Also, you are using oldish KVM packages.  You could try a modern
kernel and KVM userspace.

Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
  2011-02-15  9:19 ` Stefan Hajnoczi
@ 2011-02-15 10:15   ` Thomas Broda
  2011-02-15 15:50     ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Broda @ 2011-02-15 10:15 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: kvm

On Tue, 15 Feb 2011 09:19:23 +0000, Stefan Hajnoczi
<stefanha@gmail.com> wrote:

> Did you run dd with O_DIRECT?
 
> dd if=/dev/zero of=<path-to-device> oflag=direct bs=64k

Using O_DIRECT, performance went down to 11 MB/s on the hypervisor...

-- 
Thomas
-- 
ICQ: 		  7122237
Jabber: tbr@bassfimass.de
Web: 	www.bassfimass.de

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
  2011-02-15 10:15   ` Thomas Broda
@ 2011-02-15 15:50     ` Stefan Hajnoczi
  2011-02-16 12:50       ` Thomas Broda
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2011-02-15 15:50 UTC (permalink / raw)
  To: Thomas Broda; +Cc: kvm

On Tue, Feb 15, 2011 at 10:15 AM, Thomas Broda <thomas@bassfimass.de> wrote:
> On Tue, 15 Feb 2011 09:19:23 +0000, Stefan Hajnoczi
> <stefanha@gmail.com> wrote:
>
>> Did you run dd with O_DIRECT?
>
>> dd if=/dev/zero of=<path-to-device> oflag=direct bs=64k
>
> Using O_DIRECT, performance went down to 11 MB/s on the hypervisor...

Hmm...can you restate that as:

host  X MB/s
guest Y MB/s

I don't understand from your answer which values you have found.

Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
  2011-02-15 15:50     ` Stefan Hajnoczi
@ 2011-02-16 12:50       ` Thomas Broda
  2011-02-16 13:11         ` Stefan Hajnoczi
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Broda @ 2011-02-16 12:50 UTC (permalink / raw)
  To: kvm

On Tue, 15 Feb 2011 15:50:00 +0000, Stefan Hajnoczi
<stefanha@gmail.com> wrote:

On Tue, Feb 15, 2011 at 10:15 AM, Thomas Broda <thomas@bassfimass.de>
wrote:
Using O_DIRECT, performance went down to 11 MB/s on the hypervisor...

 
Hmm...can you restate that as:

host  X MB/s
guest Y MB/s

Trying dd with "oflag=direct" an "of=/dev/vg0/lvtest" (directly on the
KVM hypervisor) yielded a result of 11MB/s.

If I try this on the guest with /dev/vda1 as output device, results are
between 1.9MB/s and 7.7MB/s, usually around 3.5MB/s.

To sum it up:

Host: 11 MB/s
Guest: 3.5 MB/s

I've checked the RAID controller in the meantime. It's a HP Smart Array
P400. Write Caching is switched off since the contoller has no BBU
(yet).

Could it be related to this?

-- 
Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
  2011-02-16 12:50       ` Thomas Broda
@ 2011-02-16 13:11         ` Stefan Hajnoczi
  2011-02-16 15:07           ` Thomas Broda
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2011-02-16 13:11 UTC (permalink / raw)
  To: Thomas Broda; +Cc: kvm

On Wed, Feb 16, 2011 at 12:50 PM, Thomas Broda <thomas@bassfimass.de> wrote:
> On Tue, 15 Feb 2011 15:50:00 +0000, Stefan Hajnoczi
> <stefanha@gmail.com> wrote:
>
> On Tue, Feb 15, 2011 at 10:15 AM, Thomas Broda <thomas@bassfimass.de>
> wrote:
> Using O_DIRECT, performance went down to 11 MB/s on the hypervisor...
>
>
> Hmm...can you restate that as:
>
> host  X MB/s
> guest Y MB/s
>
> Trying dd with "oflag=direct" an "of=/dev/vg0/lvtest" (directly on the
> KVM hypervisor) yielded a result of 11MB/s.
>
> If I try this on the guest with /dev/vda1 as output device, results are
> between 1.9MB/s and 7.7MB/s, usually around 3.5MB/s.
>
> To sum it up:
>
> Host: 11 MB/s
> Guest: 3.5 MB/s
>
> I've checked the RAID controller in the meantime. It's a HP Smart Array
> P400. Write Caching is switched off since the contoller has no BBU
> (yet).
>
> Could it be related to this?

The disabled write cache will result in slow writes so your host
benchmark result is low on an absolute scale.  However, the relative
Guest/Host performance is very poor here (3.5/11 = 31%).

A number of performance improvements have been made to KVM and Centos
5.5 does not contain them because it is too old.  If you want to see a
more current reflection of KVM performance, you could try Fedora 14
host and guest.  The components that matter are: host kernel, qemu-kvm
userspace, and guest kernel.

Stefan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
  2011-02-16 13:11         ` Stefan Hajnoczi
@ 2011-02-16 15:07           ` Thomas Broda
  2011-02-21 12:56             ` Thomas Broda
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Broda @ 2011-02-16 15:07 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: kvm

On Wed, 16 Feb 2011 13:11:46 +0000, Stefan Hajnoczi
<stefanha@gmail.com> wrote:

> A number of performance improvements have been made to KVM and Centos
> 5.5 does not contain them because it is too old.  If you want to see a
> more current reflection of KVM performance, you could try Fedora 14
> host and guest. 

I will try Fedora then.

Thanks for helping!

-- 
Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor
  2011-02-16 15:07           ` Thomas Broda
@ 2011-02-21 12:56             ` Thomas Broda
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Broda @ 2011-02-21 12:56 UTC (permalink / raw)
  To: Thomas Broda; +Cc: Stefan Hajnoczi, kvm

On Wed, 16 Feb 2011 16:07:54 +0100, Thomas Broda <thomas@bassfimass.de>
wrote:

> I will try Fedora then.

I've installed Fedora 14 on the hypervisor last weekend, and the disk
performance is as bad as it used to be under Centos 5.5.

I think this related to the RAID controller. A Google search for "p400
slow raid5" actually says it all :-)

I think I'll get another disk and switch to RAID10 instead.

-- 
Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-02-21 12:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 18:15 Slow disk IO on virtio kvm guests with Centos 5.5 as hypervisor Thomas Broda
2011-02-15  9:19 ` Stefan Hajnoczi
2011-02-15 10:15   ` Thomas Broda
2011-02-15 15:50     ` Stefan Hajnoczi
2011-02-16 12:50       ` Thomas Broda
2011-02-16 13:11         ` Stefan Hajnoczi
2011-02-16 15:07           ` Thomas Broda
2011-02-21 12:56             ` Thomas Broda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.