mbox series

[v6,00/15] preallocate filter

Message ID 20200918181951.21752-1-vsementsov@virtuozzo.com
Headers show
Series preallocate filter | expand

Message

Vladimir Sementsov-Ogievskiy Sept. 18, 2020, 6:19 p.m. UTC
Hi all!

Here is a filter, which does preallocation on write.

In Virtuozzo we have to deal with some custom distributed storage
solution, where allocation is very-very expensive operation. We have to
workaround it in Qemu, so here is a new filter.

Still, the filter shows good results for me even for xfs and ext4.

Here are results, produced by new benchmark (last 4 patches):

All results are in iops (larger means better)

----------------------------------  -----------  -----------
                                    A            B
                                    no-prealloc  prealloc
ssd-ext4, aligned sequential 16k    19934±1.2%   27108±0.27%
                                                  A+36±2%
ssd-xfs, aligned sequential 16k     15528±5.5%   25953±3.3%
                                                  A+67±11%
hdd-ext4, aligned sequential 16k    5079±29%     3165±11%
                                                  A-38±36%
hdd-xfs, aligned sequential 16k     4096±95%     3321±7.6%
                                                  A-19±101%
ssd-ext4, unaligned sequential 64k  19969±1.9%   27043±0.49%
                                                  A+35±3%
ssd-xfs, unaligned sequential 64k   15403±2.8%   25725±6.4%
                                                  A+67±13%
hdd-ext4, unaligned sequential 64k  5250±17%     3239±8.7%
                                                  A-38±23%
hdd-xfs, unaligned sequential 64k   5291±8.2%    3336±4.2%
                                                  A-37±11%
----------------------------------  -----------  -----------

Note: it's on Fedora 30, kernel 5.6.13-100.fc30.x86_64

The tests are actually qemu-img bench, run like:

  ./qemu-img create -f qcow2 $img 16G

aligned:
  ./qemu-img bench -c 10000 -d 64 -f qcow2  -s 16k -t none -n -w $img

unaligned
  ./qemu-img bench -c 10000 -d 64 -f qcow2 -o 1k -s 64k -t none -n -w $img

and for preallocation, you'll drop -f qcow2, add --image-opts, and
instead of just $img use
  driver=qcow2,file.driver=preallocate,file.file.driver=file,file.file.filename=$img 

v6:
05: add Max's r-b
06: add Max's r-b
07: new
08: Changed a lot. really. no .active now, support more use-cases.
    Somehow, now I see performance benefit on xfs too :)
    probably due to .zero_start feature.
09: new
10: new
11: mostly rewritten, a lot more cases, drop r-b
12-15: new, to produce final benchmark table

Vladimir Sementsov-Ogievskiy (15):
  block: simplify comment to BDRV_REQ_SERIALISING
  block/io.c: drop assertion on double waiting for request serialisation
  block/io: split out bdrv_find_conflicting_request
  block/io: bdrv_wait_serialising_requests_locked: drop extra bs arg
  block: bdrv_mark_request_serialising: split non-waiting function
  block: introduce BDRV_REQ_NO_WAIT flag
  block: bdrv_check_perm(): process children anyway
  block: introduce preallocate filter
  qemu-io: add preallocate mode parameter for truncate command
  iotests: qemu_io_silent: support --image-opts
  iotests: add 298 to test new preallocate filter driver
  scripts/simplebench: support iops
  scripts/simplebench: improve view of ascii table
  scripts/simplebench: improve ascii table: add difference line
  scripts/simplebench: add bench_prealloc.py

 docs/system/qemu-block-drivers.rst.inc |  26 ++
 qapi/block-core.json                   |  20 +-
 include/block/block.h                  |  20 +-
 include/block/block_int.h              |   3 +-
 block.c                                |  10 +-
 block/file-posix.c                     |   2 +-
 block/io.c                             | 130 +++---
 block/preallocate.c                    | 556 +++++++++++++++++++++++++
 qemu-io-cmds.c                         |  46 +-
 block/meson.build                      |   1 +
 scripts/simplebench/bench_prealloc.py  | 128 ++++++
 scripts/simplebench/simplebench.py     | 103 ++++-
 tests/qemu-iotests/298                 | 186 +++++++++
 tests/qemu-iotests/298.out             |   5 +
 tests/qemu-iotests/group               |   1 +
 tests/qemu-iotests/iotests.py          |   7 +-
 16 files changed, 1146 insertions(+), 98 deletions(-)
 create mode 100644 block/preallocate.c
 create mode 100755 scripts/simplebench/bench_prealloc.py
 create mode 100644 tests/qemu-iotests/298
 create mode 100644 tests/qemu-iotests/298.out