qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hanna Reitz <hreitz@redhat.com>
To: Nir Soffer <nsoffer@redhat.com>, qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-block@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>
Subject: Re: [PATCH v2 5/5] qemu-img: Speed up checksum
Date: Mon, 12 Dec 2022 11:43:38 +0100	[thread overview]
Message-ID: <f451ccb3-17af-005b-b8ae-c43c91e7b585@redhat.com> (raw)
In-Reply-To: <20221128141514.388724-6-nsoffer@redhat.com>

On 28.11.22 15:15, Nir Soffer wrote:
> Add coroutine based loop inspired by `qemu-img convert` design.
>
> Changes compared to `qemu-img convert`:
>
> - State for the entire image is kept in ImgChecksumState
>
> - State for single worker coroutine is kept in ImgChecksumworker.
>
> - "Writes" are always in-order, ensured using a queue.
>
> - Calling block status once per image extent, when the current extent is
>    consumed by the workers.
>
> - Using 1m buffer size - testings shows that this gives best read
>    performance both with buffered and direct I/O.
>
> - Number of coroutines is not configurable. Testing does not show
>    improvement when using more than 8 coroutines.
>
> - Progress include entire image, not only the allocated state.
>
> Comparing to the simple read loop shows that this version is up to 4.67
> times faster when computing a checksum for an image full of zeroes. For
> real images it is 1.59 times faster with direct I/O, and with buffered
> I/O there is no difference.
>
> Test results on Dell PowerEdge R640 in a CentOS Stream 9 container:
>
> | image    | size | i/o       | before         | after          | change |
> |----------|------|-----------|----------------|----------------|--------|
> | zero [1] |   6g | buffered  | 1.600s ±0.014s | 0.342s ±0.016s |  x4.67 |
> | zero     |   6g | direct    | 4.684s ±0.093s | 2.211s ±0.009s |  x2.12 |
> | real [2] |   6g | buffered  | 1.841s ±0.075s | 1.806s ±0.036s |  x1.02 |
> | real     |   6g | direct    | 3.094s ±0.079s | 1.947s ±0.017s |  x1.59 |
> | nbd  [3] |   6g | buffered  | 2.455s ±0.183s | 1.808s ±0.016s |  x1.36 |
> | nbd      |   6g | direct    | 3.540s ±0.020s | 1.749s ±0.018s |  x2.02 |
>
> [1] raw image full of zeroes
> [2] raw fedora 35 image with additional random data, 50% full
> [3] image [2] exported by qemu-nbd via unix socket
>
> Signed-off-by: Nir Soffer <nsoffer@redhat.com>
> ---
>   qemu-img.c | 350 ++++++++++++++++++++++++++++++++++++++++++-----------
>   1 file changed, 277 insertions(+), 73 deletions(-)

Reviewed-by: Hanna Reitz <hreitz@redhat.com>



      reply	other threads:[~2022-12-12 10:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 14:15 [PATCH v2 0/5] Add qemu-img checksum command using blkhash Nir Soffer
2022-11-28 14:15 ` [PATCH v2 1/5] qemu-img.c: Move IO_BUF_SIZE to the top of the file Nir Soffer
2022-12-12 10:35   ` Hanna Reitz
2022-11-28 14:15 ` [PATCH v2 2/5] Support format or cache specific out file Nir Soffer
2022-12-12 10:38   ` Hanna Reitz
2022-12-13 15:56     ` Nir Soffer
2022-12-13 18:09       ` Hanna Reitz
2022-12-13 19:53         ` Nir Soffer
2022-11-28 14:15 ` [PATCH v2 3/5] qemu-img: Add checksum command Nir Soffer
2022-12-12 10:42   ` Hanna Reitz
2022-11-28 14:15 ` [PATCH v2 4/5] iotests: Test qemu-img checksum Nir Soffer
2022-12-12 10:43   ` Hanna Reitz
2022-11-28 14:15 ` [PATCH v2 5/5] qemu-img: Speed up checksum Nir Soffer
2022-12-12 10:43   ` Hanna Reitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f451ccb3-17af-005b-b8ae-c43c91e7b585@redhat.com \
    --to=hreitz@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=nsoffer@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).