On Tue, Sep 13, 2011 at 4:49 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Tue, Sep 13, 2011 at 9:31 AM, Zhi Yong Wu <zwu.ker...@gmail.com> wrote: >> On Tue, Sep 13, 2011 at 3:15 PM, Stefan Hajnoczi >> <stefa...@linux.vnet.ibm.com> wrote: >>> On Tue, Sep 13, 2011 at 10:38:28AM +0800, Zhi Yong Wu wrote: >>>> On Fri, Sep 9, 2011 at 6:38 PM, Stefan Hajnoczi >>>> <stefa...@linux.vnet.ibm.com> wrote: >>>> > On Fri, Sep 09, 2011 at 05:44:36PM +0800, Zhi Yong Wu wrote: >>>> >> Today, i did some basical I/O testing, and suddenly found that qemu >>>> >> write and rw speed is so low now, my qemu binary is built on commit >>>> >> 344eecf6995f4a0ad1d887cec922f6806f91a3f8. >>>> >> >>>> >> Do qemu have regression? >>>> >> >>>> >> The testing data is shown as below: >>>> >> >>>> >> 1.) write >>>> >> >>>> >> test: (g=0): rw=write, bs=512-512/512-512, ioengine=libaio, iodepth=1 >>>> > >>>> > Please post your QEMU command-line. If your -drive is using >>>> > cache=writethrough then small writes are slow because they require the >>>> > physical disk to write and then synchronize its write cache. Typically >>>> > cache=none is a good setting to use for local disks. >>>> > >>>> > The block size of 512 bytes is too small. Ext4 uses a 4 KB block size, >>>> > so I think a 512 byte write from the guest could cause a 4 KB >>>> > read-modify-write operation on the host filesystem. >>>> > >>>> > You can check this by running btrace(8) on the host during the >>>> > benchmark. The blktrace output and the summary statistics will show >>>> > what I/O pattern the host is issuing. >>>> 8,2 0 1 0.000000000 337 A WS 425081504 + 8 <- >>>> (253,1) 42611360 >>> >>> 8 blocks = 8 * 512 bytes = 4 KB >> How do you know each block size is 512 bytes? > > The blkparse format specifier for blocks is 'n'. Here is the code to > print it from blkparse_fmt.c: > > case 'n': > fprintf(ofp, strcat(format, "u"), t_sec(t)); > > And t_sec() is: > > #define t_sec(t) ((t)->bytes >> 9) Great, it shift 9 bit in the right direction, i.e. its unit is changed from bytes to blocks, got it, thanks.
> > So it divides the byte count by 512. Block size == sector size == 512 bytes. > > You can get the blktrace source code here: > > http://brick.kernel.dk/snaps/ > > Stefan > -- Regards, Zhi Yong Wu