Bug 886044 - throttling IO on qemu-kvm lead to bad IO BPS in windows guests
throttling IO on qemu-kvm lead to bad IO BPS in windows guests
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Stefan Hajnoczi
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2012-12-11 06:54 EST by juzhang
Modified: 2013-03-28 12:17 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-03-28 12:17:32 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description juzhang 2012-12-11 06:54:22 EST
Description of problem:
Boot quest and set bps=512000, then run "fio --filename=\\.\PHYSICALDRIVE1 --direct=1 --rw=randread --bs=1M --size=100M --name=test " in window guests. the result 259KB/s is much smaller than bps=512000 512KB/s.

Version-Release number of selected component (if applicable):
#uname -r
Guest kernel:
#uname -r

virtio-win driver

How reproducible:

Steps to Reproduce:
1.1.boot guest and set bps=512000 in one virtio-blk block
/usr/libexec/qemu-kvm -cpu Opteron_G3 -m 2048 -smp 2,sockets=1,cores=2,threads=1 -enable-kvm -name rhel64 -smbios type=1,manufacturer='Red Hat',product='RHEV Hypervisor',version=el6,serial=koTUXQrb,uuid=feebc8fd-f8b0-4e75-abc3-e63fcdb67171 -k en-us -rtc base=localtime,clock=host,driftfix=slew  -monitor stdio -qmp tcp:0:5555,server,nowait -boot menu=on -bios /usr/share/seabios/bios.bin -drive file=/home/win2008r2-new.qcow2,if=none,id=ide-disk,format=qcow2,cache=none,werror=stop,rerror=stop -device ide-drive,drive=ide-disk,id=ide -netdev tap,id=hostnet0,downscript=no -device e1000,netdev=hostnet0,id=net0,mac=00:1a:4a:2e:28:1b,bus=pci.0,addr=0x4,bootindex=2 -chardev socket,path=/tmp/isa-serial1,server,nowait,id=isa1 -device isa-serial,chardev=isa1,id=isa-serial1 -vnc :9  -drive file=/root/zhangjunyi/virtio_12G.qcow2,format=qcow2,if=none,id=block-virtio,cache=none,werror=stop,rerror=stop,bps=512000  -device virtio-blk-pci,bus=pci.0,addr=0x8,drive=block-virtio,id=block-virtio -device sga
2.Check the bps value by using hmp monitor
(qemu) info block
(qemu) info block
ide-disk: removable=0 io-status=ok file=/home/win2008r2-new.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
block-virtio: removable=0 io-status=ok file=/root/zhangjunyi/virtio_12G.qcow2 ro=0 drv=qcow2 encrypted=0 bps=512000 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0

3.Run fio tools in guest
3.1 cmd->wmic->diskdrive to identify virtio-disk's \\.\PHYSICALDRIVE1
3.2 #fio.exe --filename=\\.\PHYSICALDRIVE1 --direct=1 --rw=randread --bs=1M --size=100M --name=test 
Actual results:
#fio.exe --filename=\\.\PHYSICALDRIVE1 --direct=1 --rw=randread --bs=1M --size=100M --name=test 
Run status group 0 (all jobs):
   READ: io=102400KB, aggrb=259KB/s, minb=259KB/s, maxb=259KB/s, mint=394414msec, maxt=394414msec

Expected results:
On average, close 512KB/s as much as possible.

Additional info:
If I disable io throttling on qemu-kvm, the BPS can reach 990.11MB/s

Run status group 0 (all jobs):
   READ: io=102400KB, aggrb=990.11MB/s, minb=990.11MB/s, maxb=990.11MB/s, mint=101msec, maxt=101msec
Comment 1 juzhang 2012-12-11 07:09:18 EST
Additional infos.
1. For linux guests, I tested as well. For the details, please refer to bz885681.
2. I tested ide disk as well under the same environment, The BPS is 259KB/s.

From KVM QE POV, the actual result much bigger or smaller than specifying value are not acceptable.
Comment 2 Stefan Hajnoczi 2013-03-28 12:17:32 EDT
The result is expected behavior and has to do with the granularity of disk I/O requests.

You are running fio with blocksize 1 MB.  The guest OS breaks down the 1 MB into small requests but they are probably ~256 KB each.

Since your bps limit is 512000, it is not possible to fit 2 256 KB requests.  The result is that you only get around 259 KB per second.

Please change the fio blocksize to 4 KB and retest.  You should see that we get much closer to the bps limit.

Alternatively, raise the limit so that a single I/O request is only a small fraction of the bps limit.

Note You need to log in before you can comment on or make changes to this bug.