From: Chris Mason <chris.mason@oracle.com>
To: Miao Xie <miaox@cn.fujitsu.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: the idea for improving the performance of b-tree search
Date: Wed, 13 Oct 2010 07:24:45 -0400 [thread overview]
Message-ID: <20101013112445.GP22691@think> (raw)
In-Reply-To: <4CB57548.7000304@cn.fujitsu.com>
On Wed, Oct 13, 2010 at 05:00:56PM +0800, Miao Xie wrote:
> Hi, Chris
>
> When I investigated the performance problem of file creation/deletion, I found
> btrfs spends lots of time in the b-tree search, so I consider whether we can use
> the latest search result in the same transaction or not.
>
> My idea follows:
> we can add mask or time stamp into b-tree's node and leaf, then we know whether
> the node/leaf is COWed by the other task. If not, we check if the node/leaf of
> the latest search result contains the key that we want to search. By this way,
> we can reuse the latest search result in the same transaction and reduce the CPU
> time spent in the b-tree search.
>
> Chris, how do you think about it?
Do your results show which btree searches are happening most often? My
impression is that we are usually searching for inodes, and I see 3
different optimizations that are likely to help:
1) cache the block number of the leaf where the inode lives in the
inode, or perhaps the whole path down from the root.
2) Do delayed insertion. Each time we create a file we do a
number of btree insertions. One for the inode+name backrefs,
one for any xattrs, two for the directory entries, one for the directory
inode update.
The directory name index is especially CPU intensive because it goes in
hash order, which will mean a lot of btree balances.
Batching these insertions, even in groups of 4 or 8 will make a big
difference.
3) Do delayed inode deletion. See above, but change the word insert
with delete ;)
-chris
next prev parent reply other threads:[~2010-10-13 11:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-13 9:00 the idea for improving the performance of b-tree search Miao Xie
2010-10-13 11:24 ` Chris Mason [this message]
2010-10-13 15:22 ` David Nicol
2010-10-13 15:45 ` Chris Mason
2010-10-13 20:38 ` David Nicol
2010-10-18 2:41 ` Shaohua Li
2010-10-18 9:36 ` Miao Xie
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=20101013112445.GP22691@think \
--to=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaox@cn.fujitsu.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.