Henrique writes ...
> I'd like to know if there's any problem having like 15,000 (fifteen
!!!!!! !!!!!!!
> thousand) directories in one single directory.
!!!!!!!!
>
> I know that the "ls" command would take lots of time to show the results.
> But besides that, is there any reason to avoid doing this?
My advice .. _DON'T_ _EVEN_ _THINK_ _ABOUT_ _IT_!
I saw this horror .. just once .. with a malfunctioning mail system
running on a Sun Netra-J (an Ultra-1 makeover, for those of you
unfamiliar with the beast). 40,000 files in one mail spool directory.
Here is some (_very_ _approximate_!) math I did during the post-mortem
to this nightmare ...
150 characters/filename (Netscape Mail server tends to long
filenames).
50 bytes to round out the directory entry
(owner, group, timestamp, etc ...).
===
200 bytes/directory entry
* 400000 entries
=======
8000000 bytes/directory
Yup, that's 8 _megabytes_ in the directory's "lookup table". In fact,
an "ls -ld" on the directory itself _did_ show a size of 7.2 MB, so the
preceding rough horseback guess was not too far off-base. _ALL_ of
which has to be read when the OS asks for a particular file for __ANY__
reason. Like, say to delete it, since my task-of-the-evening was to
purge the directory.
>From here on, the numbers take a ghastly turn. Suppose the OS has to
actually read the file _from_ _disk_ each time. Hmm ... Ultra-Wide SCSI
drive, fast controller, 8 Mb .. say, about a second. Times 40,000 !!!
That is _half_ _a_ _day_ !!! Plus the piddling amount of time needed to
actually expunge the target files, of course.
In practice, the numbers were not quite this bad. Rough
"measure the wallclock for 100 operations and divide by 100" statistics
indicated that the OS was taking about 200 milliseconds/file.
I got home at about 11:00 pm that night, having eaten my dinner at a
fast-food place on the way .....
After _that_ horror, I use a rule-of-thumb: If a directory's lookup
table is sized at more than 100 Kb or so, it's getting too large. If
it cracks a Mb, the situation is an emergency one, needing immediate
corrective action.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]