On 27/04/09 at 13:36 -0400, john cooper wrote: > Lucas Nussbaum wrote: >> Hi, >> >> I'm experiencing bad disk I/O performance using virtio disks. >> >> I'm using Linux 2.6.29 (host & guest), kvm 84 userspace. >> On the host, and in a non-virtio guest, I get ~120 MB/s when writing >> with dd (the disks are fast RAID0 SAS disks). > > Could you provide detail of the exact type and size > of i/o load you were creating with dd? I tried with various block sizes. An example invocation would be: dd if=/dev/zero of=foo bs=4096 count=262144 conv=fsync (126 MB/s without virtio, 32 MB/s with virtio). > Also the full qemu cmd line invocation in both > cases would be useful. non-virtio: kvm -drive file=/tmp/debian-amd64.img,if=scsi,cache=writethrough -net nic,macaddr=00:16:3e:5a:28:1,model=e1000 -net tap -nographic -kernel /boot/vmlinuz-2.6.29 -initrd /boot/initrd.img-2.6.29 -append root=/dev/sda1 ro console=tty0 console=ttyS0,9600,8n1 virtio: kvm -drive file=/tmp/debian-amd64.img,if=virtio,cache=writethrough -net nic,macaddr=00:16:3e:5a:28:1,model=e1000 -net tap -nographic -kernel /boot/vmlinuz-2.6.29 -initrd /boot/initrd.img-2.6.29 -append root=/dev/vda1 ro console=tty0 console=ttyS0,9600,8n1 >> In a guest with a virtio disk, I get at most ~32 MB/s. > > Which non-virtio interface was used for the > comparison? if=ide I got the same performance with if=scsi >> The rest of the setup is the same. For reference, I'm running kvm -drive >> file=/tmp/debian-amd64.img,if=virtio. >> >> Is such performance expected? What should I check? > > Not expected, something is awry. > > blktrace(8) run on the host will shed some light > on the type of i/o requests issued by qemu in both > cases. Ah, I found something interesting. btrace summary after writing a 1 GB file: --- without virtio: Total (8,5): Reads Queued: 0, 0KiB Writes Queued: 272259, 1089MiB Read Dispatches: 0, 0KiB Write Dispatches: 9769, 1089MiB Reads Requeued: 0 Writes Requeued: 0 Reads Completed: 0, 0KiB Writes Completed: 9769, 1089MiB Read Merges: 0, 0KiB Write Merges: 262490, 1049MiB IO unplugs: 45973 Timer unplugs: 30 --- with virtio: Total (8,5): Reads Queued: 1, 4KiB Writes Queued: 430734, 1776MiB Read Dispatches: 1, 4KiB Write Dispatches: 196143, 1776MiB Reads Requeued: 0 Writes Requeued: 0 Reads Completed: 1, 4KiB Writes Completed: 196143, 1776MiB Read Merges: 0, 0KiB Write Merges: 234578, 938488KiB IO unplugs: 301311 Timer unplugs: 25 (I re-ran the test twice, got similar results) So, apparently, with virtio, there's a lot more data being written to disk. The underlying filesystem is ext3, and is monted as /tmp. It only contains the VM image file. Another difference is that, with virtio, the data was shared equally over all 4 CPUs, with without virt-io, CPU0 and CPU1 did all the work. In the virtio log, I also see a (null) process doing a lot of writes. I uploaded the logs to http://blop.info/bazaar/virtio/, if you want to take a look. Thank you, - Lucas -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html