on Thu, Jun 20, 2002, Adrian 'Dagurashibanipal' von Bidder (avbidder@fortytwo.ch) wrote:
> On Thu, 2002-06-20 at 12:56, Karsten M. Self wrote:
> > on Thu, Jun 20, 2002, Mark Janssen (maniac@maniac.nl) wrote:
> > > On Thu, 2002-06-20 at 10:32, Q. Gong wrote:
> > > > A general question: what's the maximum number of files located in one
> > > > directory?
> > >
> > > As many as you want... but accessing them will get slower when more
> > > files are placed in a directory.
> >
> > The hard limits are going to be inodes (fixed number per filesystem) and
>
> iirc reiser does 'inodes' differently, eliminating the hard limit. Not
> sure, though.
>
> > probably some struct limits in the filesystem, latter of which are
> > likely to be quite large.
> >
> > I've got a largeish directory here:
> >
> > $ time \ls -h | wc -l
> > 124657
> >
> > real 0m8.239s
> > user 0m3.250s
> > sys 0m0.250s
>
> Most of the time is spent sorting...
Bah! Wrong flag, I'd meant -f:
$ time \ls -f bigdir | wc -l
124659
real 0m3.341s
user 0m0.590s
sys 0m0.250s
...and if the read is cached:
$ time \ls -f bigdir | wc -l
124659
real 0m0.823s
user 0m0.550s
sys 0m0.220s
> On a dir with 70k entries, ls | wc takes 1.5 seconds, ls -f | wc takes
> 0.5 seconds.
>
> >
> > ...running reiserfs.
>
> Any data about the other fs's dir structure? XFS, JFS?
I don't know. Though both are now available for GNU/Linux, I suspect
their use is far lower than ext3 or reiser.
> > Actually, reading the directory isn't the hard part, it's adding
> > entries. I'd strongly recommend you keep ext2fs to a
>
> On ext2, I'd think adding is quick - just append the new entry. Or
> does add scan the dir, too? Opening a file will slow down as the dir
> has to be scanned. Corrections welcome, it's a long time since I've
> read about those thing.
Try something like:
MAX=<some large number>
i=0
while [ $i -lt $MAX ]
do
i=$(( i + 1 ))
ii=$(( i/100 ))
if [ $i -eq $(( ii * 100 )) ]; then echo $i; fi
touch file-$i
done
...for various values of MAX, on various filesystems. I found that
inserts on ext2 slow markedly at the 5-10k range.
Peace.
--
Karsten M. Self <kmself@ix.netcom.com> http://kmself.home.netcom.com/
What Part of "Gestalt" don't you understand?
Use a personal CSS stylesheet to promote Web usability:
http://kmself.home.netcom.com/Download/UserContent.css
http://kmself.home.netcom.com/Download/test-css.html
Attachment:
pgpr2rm5gxaVA.pgp
Description: PGP signature