From: "Holger Hoffstätte" <holger.hoffstaette@googlemail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: Performance Issues
Date: Mon, 22 Sep 2014 12:37:59 +0000 (UTC) [thread overview]
Message-ID: <pan.2014.09.22.12.37.58@googlemail.com> (raw)
In-Reply-To: 20140922115903.GJ9715@twin.jikos.cz
On Mon, 22 Sep 2014 13:59:03 +0200, David Sterba wrote:
> On Fri, Sep 19, 2014 at 01:34:38PM +0000, Holger Hoffstätte wrote:
>>
>> I'd also love a technical explanation why this happens and how it could
>> be fixed. Maybe it's just a consequence of how the metadata tree(s)
>> are laid out on disk.
>
> The stat() call is the most severe slowdown factor in combination with
> fragmentation and random order of the inodes that are being stat()ed.
>
> A 'ls -f' (that does not stat) goes only through the DIR_INDEX_KEY items
> in the b-tree that are usually packed together and reading is sequential
> and fast.
>
> A 'ls' that calls stat() in turn will have to seek for the INODE_ITEM
> item that can be far from all the currently read metadata blocks.
Thanks Dave - that confirms everything I (unscientifically ;) observed so
far, since I also tried to use "find" to warm up (in the hope it would
cache the relevant metadata blocks), but running with strace showed that
it does - of course! - not call stat on each inode, and just quickly reads
the directory entry list (via getdents()).
This meant that even after a full "find" a subsequent "du" would still be
slow(er). Both the cold "find" and a cold "du" also *sound* noticeably
different, in terms of disk head scratching; find is significantly less
seeky.
Interesting that you also mention the readahead. I've run the "du" warmup
under Brendan Gregg's iosnoop and it shows that most stat()-heavy I/O is
done in 16k blocks, while ext4 only seems to use 4k.
Time to look at the trees in detail.. :)
-h
next prev parent reply other threads:[~2014-09-22 12:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-19 12:18 Performance Issues Rob Spanton
2014-09-19 12:25 ` Swâmi Petaramesh
2014-09-19 12:58 ` Austin S Hemmelgarn
2014-09-19 12:49 ` Austin S Hemmelgarn
2014-09-19 12:59 ` Austin S Hemmelgarn
2014-09-19 13:34 ` Holger Hoffstätte
2014-09-22 11:59 ` David Sterba
2014-09-22 12:37 ` Holger Hoffstätte [this message]
2014-09-22 13:25 ` David Sterba
2014-09-19 13:51 ` Holger Hoffstätte
2014-09-19 14:53 ` Austin S Hemmelgarn
2014-09-19 16:23 ` Holger Hoffstätte
2014-09-19 17:51 ` Zach Brown
2014-09-20 8:23 ` Marc Dietrich
2014-09-20 13:41 ` Martin
2014-09-20 18:29 ` Chris Murphy
2014-09-20 14:04 ` Wang Shilong
2014-09-20 20:44 ` Marc Dietrich
2014-09-19 15:05 ` Josef Bacik
2014-09-19 16:51 ` Rob Spanton
2014-09-19 17:45 ` Josef Bacik
2014-10-30 14:23 ` Rob Spanton
2014-09-20 5:58 ` Duncan
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=pan.2014.09.22.12.37.58@googlemail.com \
--to=holger.hoffstaette@googlemail.com \
--cc=linux-btrfs@vger.kernel.org \
/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).