linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dax writes on ext4 slower than direct-i/o?
@ 2019-07-30 23:49 Dan Williams
  2019-08-02 14:43 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2019-07-30 23:49 UTC (permalink / raw)
  To: linux-ext4; +Cc: Jan Kara, Berrocal, Eduardo

Hi all,

Eduardo raised a puzzling question about why dax yields lower iops
than direct-i/o. The expectation is the reverse, i.e. that direct-i/o
should be slightly slower than dax due to block layer overhead. This
holds true for xfs, but on ext4 dax yields half the iops of direct-i/o
for an fio 4K random write workload.

Here is a relative graph of ext4: dax + direct-i/o vs xfs: dax + direct-i/o

https://user-images.githubusercontent.com/56363/62172754-40c01e00-b2e8-11e9-8e4e-29e09940a171.jpg

A relative perf profile seems to show more time in
ext4_journal_start() which I thought may be due to atime or mtime
updates, but those do not seem to be the source of the extra journal
I/O.

The urgency is a curiosity at this point, but I expect an end user
might soon ask whether this is an expected implementation side-effect
of dax.

Thanks in advance for any insight, and/or experiment ideas for us to go try.

Eduardo collected perf reports of these runs here:

https://github.com/pmem/ndctl/files/3449231/linux_5.3.2_perf.zip

...and the fio configuration is here:

https://gist.github.com/djbw/e5e69cbccbaaf0f43ecde127393c305c

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dax writes on ext4 slower than direct-i/o?
  2019-07-30 23:49 dax writes on ext4 slower than direct-i/o? Dan Williams
@ 2019-08-02 14:43 ` Jan Kara
  2019-08-02 15:38   ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2019-08-02 14:43 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-ext4, Jan Kara, Berrocal, Eduardo

Hi Dan!

On Tue 30-07-19 16:49:41, Dan Williams wrote:
> Eduardo raised a puzzling question about why dax yields lower iops
> than direct-i/o. The expectation is the reverse, i.e. that direct-i/o
> should be slightly slower than dax due to block layer overhead. This
> holds true for xfs, but on ext4 dax yields half the iops of direct-i/o
> for an fio 4K random write workload.
> 
> Here is a relative graph of ext4: dax + direct-i/o vs xfs: dax + direct-i/o
> 
> https://user-images.githubusercontent.com/56363/62172754-40c01e00-b2e8-11e9-8e4e-29e09940a171.jpg
> 
> A relative perf profile seems to show more time in
> ext4_journal_start() which I thought may be due to atime or mtime
> updates, but those do not seem to be the source of the extra journal
> I/O.
> 
> The urgency is a curiosity at this point, but I expect an end user
> might soon ask whether this is an expected implementation side-effect
> of dax.
> 
> Thanks in advance for any insight, and/or experiment ideas for us to go try.

Yeah, I think the reason is that ext4_iomap_begin() currently starts a
transaction unconditionally for each write whereas ext4_direct_IO_write()
is more clever and starts a transaction only when needing to allocate any
blocks. We could put similar smarts into ext4_iomap_begin() and it's
probably a good idea, just at this moment I'm working with one guy on
moving ext4 direct IO code to iomap infrastructure which overhauls
ext4_iomap_begin() anyway, so let's do this after that work.

								Honza

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dax writes on ext4 slower than direct-i/o?
  2019-08-02 14:43 ` Jan Kara
@ 2019-08-02 15:38   ` Dan Williams
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Williams @ 2019-08-02 15:38 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4, Berrocal, Eduardo

On Fri, Aug 2, 2019 at 7:43 AM Jan Kara <jack@suse.cz> wrote:
>
> Hi Dan!
>
> On Tue 30-07-19 16:49:41, Dan Williams wrote:
> > Eduardo raised a puzzling question about why dax yields lower iops
> > than direct-i/o. The expectation is the reverse, i.e. that direct-i/o
> > should be slightly slower than dax due to block layer overhead. This
> > holds true for xfs, but on ext4 dax yields half the iops of direct-i/o
> > for an fio 4K random write workload.
> >
> > Here is a relative graph of ext4: dax + direct-i/o vs xfs: dax + direct-i/o
> >
> > https://user-images.githubusercontent.com/56363/62172754-40c01e00-b2e8-11e9-8e4e-29e09940a171.jpg
> >
> > A relative perf profile seems to show more time in
> > ext4_journal_start() which I thought may be due to atime or mtime
> > updates, but those do not seem to be the source of the extra journal
> > I/O.
> >
> > The urgency is a curiosity at this point, but I expect an end user
> > might soon ask whether this is an expected implementation side-effect
> > of dax.
> >
> > Thanks in advance for any insight, and/or experiment ideas for us to go try.
>
> Yeah, I think the reason is that ext4_iomap_begin() currently starts a
> transaction unconditionally for each write whereas ext4_direct_IO_write()
> is more clever and starts a transaction only when needing to allocate any
> blocks. We could put similar smarts into ext4_iomap_begin() and it's
> probably a good idea, just at this moment I'm working with one guy on
> moving ext4 direct IO code to iomap infrastructure which overhauls
> ext4_iomap_begin() anyway, so let's do this after that work.

Sounds good, thanks for the insight!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-02 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 23:49 dax writes on ext4 slower than direct-i/o? Dan Williams
2019-08-02 14:43 ` Jan Kara
2019-08-02 15:38   ` Dan Williams

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).