Re: IO on guest is 20 times slower than host

Kurt Yoder
2009-03-25T16:28:31Z

On Mar 25, 2009, at 12:13 PM, Avi Kivity wrote:

> Kurt Yoder wrote:
>> Hello list,
>>
>> I'm puzzled as to why my KVM guest has IO that is 20 times slower
>> than the KVM host:
>>
>> me@guest:~$ dd if=/dev/zero of=/tmp/bigfile count=100000
>> 100000+0 records in
>> 100000+0 records out
>> 51200000 bytes (51 MB) copied, 8.36612 s, 6.1 MB/s
>> me@guest:~$ df -h
>> Filesystem Size Used Avail Use% Mounted on
>> /dev/vda1 9.2G 587M 8.2G 7% /
>> tmpfs 123M 0 123M 0% /lib/init/rw
>> varrun 123M 28K 123M 1% /var/run
>> varlock 123M 0 123M 0% /var/lock
>> udev 123M 2.6M 120M 3% /dev
>> tmpfs 123M 0 123M 0% /dev/shm
>>
>>
>>
>> me@host:~$ dd if=/dev/zero of=/tmp/bigfile count=100000
>> 100000+0 records in
>> 100000+0 records out
>> 51200000 bytes (51 MB) copied, 0.47188 s, 109 MB/s
>>
>>
>>
>> The VM is started via libvirt and is the only VM running on an
>> otherwise-unused system:
>>
>> root 19915 1 0 Mar24 ? 00:00:00 /usr/sbin/
>> libvirtd -d
>> nobody 19937 19915 0 Mar24 ? 00:00:00 dnsmasq --keep-
>> in-foreground --strict-order --bind-interfaces --pid-file --conf-
>> file --listen-address 192.168.122.1 --except-interface lo --dhcp-
>> leasefile=/var/lib/libvirt/dhcp-default.leases --dhcp-range
>> 192.168.122.2,192.168.122.254
>> root 24354 19915 2 09:52 ? 00:02:33 /usr/bin/kvm -S
>> -M pc -m 256 -smp 1 -name guest -monitor pty -boot c -drive file=/
>> dev/HW_RAID/Guest,if=virtio,index=0,boot=on -net
>> nic,macaddr=52:54:00:ba:e6:db,vlan=0,model=virtio -net
>> tap,fd=11,script=,vlan=0,ifname=vnet1 -serial none -parallel none -
>> usb -vnc 127.0.0.1:1
>>
>>
>>
>> Can someone suggest where to start looking? Thanks,
>
> I get 141 MB/s on the same test (it only copies to memory anyway).
> Is your VM under memory pressure?

I don't think so. The host has 128 GB of memory, and even the pre-
emptive kernel caching doesn't come close to filling it:

me@host:~$ free
total used free shared buffers
cached
Mem: 132043960 1742480 130301480 0 84628
826040
-/+ buffers/cache: 831812 131212148
Swap: 1048568 0 1048568

My /tmp should be physical disk in both cases. To be thorough, I also
ran the test while writing the output file to /, and got the same
results (5.7 MB/s on guest, 144 MB/s on host).

-Kurt