mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@arcor.de>
To: Alex Tomas <bzzz@tmi.comex.ru>, "Martin J. Bligh" <mbligh@aracnet.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	ext2-devel@lists.sourceforge.net, "Theodore Ts'o" <tytso@mit.edu>,
	Andrew Morton <akpm@digeo.com>, Alex Tomas <bzzz@tmi.comex.ru>
Subject: Re: [Bug 417] New: htree much slower than regular ext3
Date: Sat, 8 Mar 2003 18:38:50 +0100	[thread overview]
Message-ID: <20030307173425.5C4D3FAAAE@mx12.arcor-online.net> (raw)
In-Reply-To: <m34r6fyya8.fsf@lexa.home.net>

On Fri 07 Mar 03 16:46, Alex Tomas wrote:
> Hi!
>
> The problem is that getdents(2) returns inodes out of order and
> du causes many head seeks. I tried to solve the problem by patch
> I included in. The idea of the patch is pretty simple: just try
> to sort dentries by inode number in readdir(). It works because
> inodes sits at fixed places in ext2/ext3. Please, look at results
> I just got:
>
>                   real        user         sys
>
> ext3+htree:  7m22.236s    0m0.292s    0m2.204s
> ext3-htree:  3m6.539s     0m0.481s    0m2.278s
> [...]
> ext3+sd-30:  2m39.658s    0m0.492s    0m2.138s

Nice.  I posted a similar demonstration some time ago (could it *really* be 
two years?) but I sorted the dirents in user space, which meant it was just a 
demonstration, not a practical solution.

The problem I see with your approach is that the traversal is no longer in 
hash order, so a leaf split in the middle of a directory traversal could 
result in a lot of duplicate dirents.  I'm not sure there's a way around that.

Another approach is to have the inode number correspond approximately to the 
hash value.  That's not as hard as it sounds, it simply means that the goal 
for ext3_new_inode should be influenced by the hash value.  (But watch out 
for interaction with the new Orlov allocator.)  It also depends on some
a priori estimate of the size of a directory so that increasing hash values 
can be distributed more or less uniformly and monotonically across some 
corresponding range of inode numbers. This isn't too hard either, just round 
up the current size of the directory to a power of two and use that as the 
size estimate.  The size estimate would change from time to time over the 
life of the directory, but there are only log N different sizes and that's 
roughly how heavy the load on the inode cache would be during a directory 
traversal.  Finally, a nice property of this approach is that it stays stable 
over many creates and deletes.

We've apparently got a simpler problem though: inode numbers aren't allocated 
densely enough in the inode table blocks.  This is the only thing I can think 
of that could cause the amount of thrashing we're seeing.  Spreading inode 
number allocations out all over a volume is ok, but sparse allocation within 
each table block is not ok because it multiplies the pressure on the cache.  
We want a 30,000 entry directory to touch 1,000 - 2,000 inode table blocks, 
not the worst-case 30,000.  As above, fixing this comes down to tweaking the 
ext3_new_inode allocation goal.

Regards,

Daniel

  reply	other threads:[~2003-03-07 17:24 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-27 17:31 Martin J. Bligh
2003-02-28  2:55 ` Daniel Phillips
2003-02-27 21:00   ` Andreas Dilger
2003-02-28  4:12     ` Daniel Phillips
2003-02-27 21:33       ` Martin J. Bligh
2003-03-13 21:04     ` [Ext2-devel] " Stephen C. Tweedie
2003-03-07 15:46 ` Alex Tomas
2003-03-08 17:38   ` Daniel Phillips [this message]
2003-03-07 23:27     ` Theodore Ts'o
2003-03-09 19:26       ` Alex Tomas
2003-03-09  7:08     ` Alex Tomas
2003-03-10 17:58       ` Daniel Phillips
2003-03-10 21:25       ` Theodore Ts'o
2003-03-11 21:57   ` Bill Davidsen
     [not found] ` <20030307214833.00a37e35.akpm@digeo.com>
     [not found]   ` <20030308010424.Z1373@schatzie.adilger.int>
2003-03-09 22:54     ` [Ext2-devel] " Daniel Phillips
2003-03-08 23:19       ` Andrew Morton
2003-03-09 23:10   ` Daniel Phillips
     [not found] ` <20030309184755.ACC80FCA8C@mx12.arcor-online.net>
     [not found]   ` <m3u1ecl5h8.fsf@lexa.home.net>
2003-03-10 20:45     ` [RFC] Improved inode number allocation for HTree Daniel Phillips
     [not found]       ` <3E6D1D25.5000004@namesys.com>
     [not found]         ` <20030311031216.8A31CEFD5F@mx12.arcor-online.net>
2003-03-11 10:45           ` Hans Reiser
2003-03-11 13:00             ` Helge Hafting
2003-03-11 13:41               ` Daniel Phillips
2003-03-11 17:16                 ` Andreas Dilger
2003-03-11 19:39                 ` Helge Hafting
2003-03-11 20:19                   ` Daniel Phillips
2003-03-11 21:25                 ` atomic kernel operations are very tricky to export to user space (was [RFC] Improved inode number allocation for HTree ) Hans Reiser
2003-03-11 23:49                   ` Jamie Lokier
2003-03-10 20:48     ` [RFC] Improved inode number allocation for HTree Daniel Phillips
2003-03-10 21:04       ` John Bradford
2003-03-10 21:28         ` Andreas Schwab
2003-03-10 21:50           ` Filesystem write priorities, (Was: Re: [RFC] Improved inode number allocation for HTree) John Bradford
2003-03-14 21:55             ` [Ext2-devel] " Stephen C. Tweedie
2003-03-10 21:33         ` [RFC] Improved inode number allocation for HTree Daniel Phillips
2003-03-10 21:47           ` [Ext2-devel] " Bryan O'Sullivan
2003-03-10 22:02             ` Matthew Wilcox
2003-03-11  8:47               ` Jakob Oestergaard
2003-03-11 11:27                 ` John Bradford
2003-03-14 21:57               ` Stephen C. Tweedie
2003-03-15  8:39                 ` jw schultz

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=20030307173425.5C4D3FAAAE@mx12.arcor-online.net \
    --to=phillips@arcor.de \
    --cc=akpm@digeo.com \
    --cc=bzzz@tmi.comex.ru \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=tytso@mit.edu \
    /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

all inboxes | Powered by JetHome®