qemu-e2k/docs
Nir Soffer 0961525705 qemu-nbd: Change default cache mode to writeback
Both qemu and qemu-img use writeback cache mode by default, which is
already documented in qemu(1). qemu-nbd uses writethrough cache mode by
default, and the default cache mode is not documented.

According to the qemu-nbd(8):

   --cache=CACHE
          The  cache  mode  to be used with the file.  See the
          documentation of the emulator's -drive cache=... option for
          allowed values.

qemu(1) says:

    The default mode is cache=writeback.

So users have no reason to assume that qemu-nbd is using writethough
cache mode. The only hint is the painfully slow writing when using the
defaults.

Looking in git history, it seems that qemu used writethrough in the past
to support broken guests that did not flush data properly, or could not
flush due to limitations in qemu. But qemu-nbd clients can use
NBD_CMD_FLUSH to flush data, so using writethrough does not help anyone.

Change the default cache mode to writback, and document the default and
available values properly in the online help and manual.

With this change converting image via qemu-nbd is 3.5 times faster.

    $ qemu-img create dst.img 50g
    $ qemu-nbd -t -f raw -k /tmp/nbd.sock dst.img

Before this change:

    $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
    Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
      Time (mean ± σ):     83.639 s ±  5.970 s    [User: 2.733 s, System: 6.112 s]
      Range (min … max):   76.749 s … 87.245 s    3 runs

After this change:

    $ hyperfine -r3 "./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock"
    Benchmark #1: ./qemu-img convert -p -f raw -O raw -T none -W fedora34.img nbd+unix:///?socket=/tmp/nbd.sock
      Time (mean ± σ):     23.522 s ±  0.433 s    [User: 2.083 s, System: 5.475 s]
      Range (min … max):   23.234 s … 24.019 s    3 runs

Users can avoid the issue by using --cache=writeback[1] but the defaults
should give good performance for the common use case.

[1] https://bugzilla.redhat.com/1990656

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-Id: <20210813205519.50518-1-nsoffer@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Eric Blake <eblake@redhat.com>
2021-09-29 13:46:31 -05:00
..
_templates docs: Add QEMU version information to HTML footer 2021-07-18 10:59:47 +01:00
about docs: add supported host CPU architectures section 2021-09-14 16:51:58 +04:00
config
devel tests/Makefile: add AVOCADO_TESTS option to make check-acceptance 2021-09-27 19:06:47 +02:00
interop docs: standardize directory index to --- with overline 2021-09-13 13:56:26 +02:00
specs docs: standardize directory index to --- with overline 2021-09-13 13:56:26 +02:00
sphinx qapidoc: introduce QAPISchemaIfCond.docgen() 2021-08-26 13:53:56 +02:00
sphinx-static sphinx: adopt kernel readthedoc theme 2021-05-14 15:05:03 +04:00
spin
system multi-process: fix usage information 2021-09-27 10:57:21 +02:00
tools qemu-nbd: Change default cache mode to writeback 2021-09-29 13:46:31 -05:00
user docs: standardize directory index to --- with overline 2021-09-13 13:56:26 +02:00
amd-memory-encryption.txt docs: Add SEV-ES documentation to amd-memory-encryption.txt 2021-06-17 14:11:06 -04:00
block-replication.txt
bypass-iommu.txt docs: Add documentation for iommu bypass 2021-07-16 11:10:45 -04:00
can.txt docs: Fix some typos (found by codespell) 2020-11-18 09:29:41 +01:00
ccid.txt hw/usb/ccid: remove references to NSS 2021-07-14 14:33:53 +01:00
COLO-FT.txt docs: update to show preferred boolean syntax for -cpu 2021-02-25 14:14:33 +01:00
colo-proxy.txt docs: update to show preferred boolean syntax for -chardev 2021-02-25 14:14:33 +01:00
conf.py docs: Fix documentation Copyright date 2021-07-18 10:59:46 +01:00
confidential-guest-support.txt s390: Recognize confidential-guest-support option 2021-02-08 16:57:38 +11:00
defs.rst.inc docs: Fix typo in the default name of the qemu-system-x86_64 binary 2021-04-01 14:28:39 +02:00
hyperv.txt i386: hardcode supported eVMCS version to '1' 2021-07-13 09:13:29 -04:00
igd-assign.txt
image-fuzzer.txt
index.rst docs: standardize book titles to === with overline 2021-09-13 13:56:26 +02:00
memory-hotplug.txt
meson.build docs: make sphinx-build be quiet by default 2021-08-25 12:19:18 +02:00
multi-thread-compression.txt
multiseat.txt
nvdimm.txt docs/nvdimm: Update nvdimm option value in machine example 2021-09-27 10:57:21 +02:00
papr-pef.txt spapr: Add PEF based confidential guest support 2021-02-08 16:57:38 +11:00
pci_expander_bridge.txt
pcie_pci_bridge.txt docs: add slot when adding new PCIe root port 2021-07-03 03:12:35 -04:00
pcie.txt
pvrdma.txt docs: Fix broken links 2020-09-01 09:31:33 +02:00
qcow2-cache.txt qcow2: Document the Extended L2 Entries feature 2020-08-25 08:33:20 +02:00
qdev-device-use.txt hw/ide: remove 'ide-drive' device 2021-03-18 09:22:55 +00:00
qemu_logo.pdf
qemu-option-trace.rst.inc qemu-option-trace.rst.inc: Don't use option:: markup 2020-11-02 16:52:18 +00:00
qemupciserial.inf
rdma.txt migrate: remove QMP/HMP commands for speed, downtime and cache size 2021-03-18 09:22:55 +00:00
replay.txt docs: Fix some typos (found by codespell) 2020-11-18 09:29:41 +01:00
spice-port-fqdn.txt
throttle.txt docs: Document the throttle block filter 2020-10-02 15:46:40 +02:00
u2f.txt hw/usb: Add U2F device autoscan to passthru mode 2020-08-31 08:23:39 +02:00
virtio-balloon-stats.txt
xbzrle.txt migrate: remove QMP/HMP commands for speed, downtime and cache size 2021-03-18 09:22:55 +00:00
xen-save-devices-state.txt