All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Eric Wheeler <lvm-dev@lists.ewheeler.net>
Cc: dm-devel@redhat.com, ejt@redhat.com,
	LVM2 development <lvm-devel@redhat.com>
Subject: Re: [lvm-devel] dm thin: optimize away writing all zeroes to unprovisioned blocks
Date: Tue, 09 Dec 2014 08:31:30 -0700	[thread overview]
Message-ID: <548715D2.1000509@kernel.dk> (raw)
In-Reply-To: <alpine.DEB.2.02.1412082258460.10718@ware.dreamhost.com>

On 12/09/2014 01:02 AM, Eric Wheeler wrote:
> On Fri, 5 Dec 2014, Mike Snitzer wrote:
>> I do wonder what the performance impact is on this for dm. Have you
>> tried a (worst case) test of writing blocks that are zero filled,
>
> Jens, thank you for your help w/ fio for generating zeroed writes!
> Clearly fio is superior to dd as a sequential benchmarking tool; I was
> actually able to push on the system's memory bandwidth.
>
> Results:
>
> I hacked block/loop.c and md/dm-thin.c to always call bio_is_zero_filled()
> and then complete without writing to disk, regardless of the return value
> from bio_is_zero_filled().  In loop.c this was done in
> do_bio_filebacked(), and for dm-thin.c this was done within
> provision_block().
>
> This allows us to compare the performance difference between the simple
> loopback block device driver vs the more complex dm-thinp implementation
> just prior to block allocation.  These benchmarks give us a sense of how
> performance differences relate between bio_is_zero_filled() and block
> device implementation complexity, in addition to the raw performance of
> bio_is_zero_filled in best- and worst-case scenarios.
>
> Since we always complete without writing after the call to
> bio_is_zero_filled, regardless of the bio's content (all zeros or not), we
> can benchmark the difference in the common use case of random data, as
> well as the edge case of skipping writes for bio's that contain all zeros
> when writing to unallocated space of thin-provisioned volumes.
>
> These benchmarks were performed under KVM, so expect them to be lower
> bounds due to overhead.  The hardware is a Intel(R) Xeon(R) CPU E3-1230 V2
> @ 3.30GHz.  The VM was allocated 4GB of memory with 4 cpu cores.
>
> Benchmarks were performed using fio-2.1.14-33-gf8b8f
>   --name=writebw
>   --rw=write
>   --time_based
>   --runtime=7 --ramp_time=3
>   --norandommap
>   --ioengine=libaio
>   --group_reporting
>   --direct=1
>   --bs=1m
>   --filename=/dev/X
>   --numjobs=Y
>
> Random data was tested using:
>    --zero_buffers=0 --scramble_buffers=1
>
> Zeroed data was tested using:
>    --zero_buffers=1 --scramble_buffers=0
>
> Values below are from aggrb.
>
>                dm-thinp (MB/s)   loopback (MB/s)   loop faster by factor of
> ==============+======================================================
> random jobs=4 | 18496.0          33522.0           1.68x
> zeros  jobs=4 |  8119.2           9767.2           1.20x
> ==============+======================================================
> random jobs=1 |  7330.5          12330.0           1.81x
> zeros  jobs=1 |  4965.2           6799.9           1.11x

This looks more reasonable in terms of throughput.

One major worry here is that checking every write is blowing your cache, 
so you could have a major impact on performance in general. Even for 
O_DIRECT writes, you are now accessing the memory. Have you looked into 
doing non-temporal memory compares instead? I think that would be the 
way to go.

-- 
Jens Axboe

WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <axboe@kernel.dk>
To: lvm-devel@redhat.com
Subject: dm thin: optimize away writing all zeroes to unprovisioned blocks
Date: Tue, 09 Dec 2014 08:31:30 -0700	[thread overview]
Message-ID: <548715D2.1000509@kernel.dk> (raw)
In-Reply-To: <alpine.DEB.2.02.1412082258460.10718@ware.dreamhost.com>

On 12/09/2014 01:02 AM, Eric Wheeler wrote:
> On Fri, 5 Dec 2014, Mike Snitzer wrote:
>> I do wonder what the performance impact is on this for dm. Have you
>> tried a (worst case) test of writing blocks that are zero filled,
>
> Jens, thank you for your help w/ fio for generating zeroed writes!
> Clearly fio is superior to dd as a sequential benchmarking tool; I was
> actually able to push on the system's memory bandwidth.
>
> Results:
>
> I hacked block/loop.c and md/dm-thin.c to always call bio_is_zero_filled()
> and then complete without writing to disk, regardless of the return value
> from bio_is_zero_filled().  In loop.c this was done in
> do_bio_filebacked(), and for dm-thin.c this was done within
> provision_block().
>
> This allows us to compare the performance difference between the simple
> loopback block device driver vs the more complex dm-thinp implementation
> just prior to block allocation.  These benchmarks give us a sense of how
> performance differences relate between bio_is_zero_filled() and block
> device implementation complexity, in addition to the raw performance of
> bio_is_zero_filled in best- and worst-case scenarios.
>
> Since we always complete without writing after the call to
> bio_is_zero_filled, regardless of the bio's content (all zeros or not), we
> can benchmark the difference in the common use case of random data, as
> well as the edge case of skipping writes for bio's that contain all zeros
> when writing to unallocated space of thin-provisioned volumes.
>
> These benchmarks were performed under KVM, so expect them to be lower
> bounds due to overhead.  The hardware is a Intel(R) Xeon(R) CPU E3-1230 V2
> @ 3.30GHz.  The VM was allocated 4GB of memory with 4 cpu cores.
>
> Benchmarks were performed using fio-2.1.14-33-gf8b8f
>   --name=writebw
>   --rw=write
>   --time_based
>   --runtime=7 --ramp_time=3
>   --norandommap
>   --ioengine=libaio
>   --group_reporting
>   --direct=1
>   --bs=1m
>   --filename=/dev/X
>   --numjobs=Y
>
> Random data was tested using:
>    --zero_buffers=0 --scramble_buffers=1
>
> Zeroed data was tested using:
>    --zero_buffers=1 --scramble_buffers=0
>
> Values below are from aggrb.
>
>                dm-thinp (MB/s)   loopback (MB/s)   loop faster by factor of
> ==============+======================================================
> random jobs=4 | 18496.0          33522.0           1.68x
> zeros  jobs=4 |  8119.2           9767.2           1.20x
> ==============+======================================================
> random jobs=1 |  7330.5          12330.0           1.81x
> zeros  jobs=1 |  4965.2           6799.9           1.11x

This looks more reasonable in terms of throughput.

One major worry here is that checking every write is blowing your cache, 
so you could have a major impact on performance in general. Even for 
O_DIRECT writes, you are now accessing the memory. Have you looked into 
doing non-temporal memory compares instead? I think that would be the 
way to go.

-- 
Jens Axboe



  reply	other threads:[~2014-12-09 15:31 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 18:38 dm-thinp feature request: skip allocation on writes of all zeroes Eric Wheeler
2014-09-30 19:30 ` Zdenek Kabelac
2014-09-30 20:13 ` Mike Snitzer
2014-09-30 22:38   ` Eric Wheeler
2014-12-04  7:05 ` [PATCH] dm-thinp: skip allocation on writes of all zeros to unallocated blocks Eric Wheeler
2014-12-04  7:25   ` Eric Wheeler
2014-12-04 15:33     ` [PATCH] dm thin: optimize away writing all zeroes to unprovisioned blocks Mike Snitzer
2014-12-04 15:33       ` Mike Snitzer
2014-12-04 15:43       ` Mike Snitzer
2014-12-04 15:43         ` Mike Snitzer
2014-12-06 22:33         ` Eric Wheeler
2014-12-06 22:33           ` Eric Wheeler
2014-12-05 14:47       ` Mike Snitzer
2014-12-05 14:47         ` Mike Snitzer
2014-12-06 22:36         ` Eric Wheeler
2014-12-06 22:36           ` Eric Wheeler
2014-12-05 17:27       ` [PATCH] " Jens Axboe
2014-12-05 17:27         ` Jens Axboe
2014-12-05 18:33         ` Mike Snitzer
2014-12-05 18:33           ` Mike Snitzer
2014-12-06 22:40           ` Eric Wheeler
2014-12-06 22:40             ` Eric Wheeler
2014-12-07  1:41             ` [lvm-devel] " Jens Axboe
2014-12-07  1:41               ` Jens Axboe
2014-12-07  6:30               ` Eric Wheeler
2014-12-07  6:30                 ` Eric Wheeler
2014-12-07  6:45                 ` Eric Wheeler
2014-12-07  6:45                   ` Eric Wheeler
2014-12-08 16:57                 ` [lvm-devel] " Jens Axboe
2014-12-08 16:57                   ` Jens Axboe
2014-12-09  8:02                   ` Eric Wheeler
2014-12-09  8:02                     ` Eric Wheeler
2014-12-09 15:31                     ` Jens Axboe [this message]
2014-12-09 15:31                       ` Jens Axboe
2014-12-09 15:41                       ` [lvm-devel] " Jens Axboe
2014-12-09 15:41                         ` Jens Axboe
2014-12-10  2:52                         ` [PATCH] " Eric Wheeler
2014-12-10  2:52                           ` Eric Wheeler
2015-01-26  2:53                       ` Eric Wheeler
2015-01-26  2:53                         ` Eric Wheeler
2015-02-15  0:31                         ` [lvm-devel] " Eric Wheeler
2015-02-15  0:31                           ` Eric Wheeler
2014-12-09 14:38                   ` Marian Csontos
2014-12-09 14:38                     ` Marian Csontos
2014-12-07  1:36           ` Jens Axboe
2014-12-07  1:36             ` Jens Axboe

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=548715D2.1000509@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    --cc=lvm-dev@lists.ewheeler.net \
    --cc=lvm-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.