[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ossig] Two obscure questions: directory access times and atomicrename()



On 07/09/2004 09:49 Christopher DeMarco said the following:
> 1.    It is  certainly  true  that the   time taken to   open() a file
> increases with the number of files in the directory  - e.g.  reading 1
> file out of 100 is faster than reading 1  file out of 1000.  Are there

yes, the inode table lookups will obviously be longer if there're more 
files in the directory. however, lookup names are cached on UFS, though 
the other filesystems may employ a similar structure. caches help when 
you're accessing the same files over and over again, but maybe less so 
for a filesystem storing mail spools. you may also want to look at 
filesystem parameters for Usenet news spools as they too have the same 
attributes: lots of small files spread in a very hierarchical directory 
structure.

> to maximize seek time within a directory while  conserving inodes?  If
> I put everything in  its own directory then  obviously it'll be a snap
> to open(), but I'll burn inodes  twice as fast.   Is there a watershed

it's a tradeoff between inodes and time. they're usually mutually 
exclusive, i.e. you either veer towards saving inodes or saving time. 
the middle point is elusive and would differ from app to app, so best to 
see which profile your app fits and then adopt the same strategies which 
others have for mail spools and usenet news spools.

> directory?   Is this  (horrors!)  fs-specific,  where e.g. JFS  scales
> better than XFS?  Aargh.

they are different from filesystem to filesystem, but the underlying 
structure (inodes et al) would remain the same. what would differ would 
be the lookup, writeback and syncing algorithms.

> no mention of atomicity when *creating*  the target file.  Is rename()
> atomic when <newname> doesn't yet exist?

that isn't atomic due to the need to allocate a new name entry.

-- 
Regards,                           /\_/\   "All dogs go to heaven."
dinesh@alphaque.com                (0 0)    http://www.alphaque.com/
+==========================----oOO--(_)--OOo----==========================+
| for a in past present future; do                                        |
|   for b in clients employers associates relatives neighbours pets; do   |
|   echo "The opinions here in no way reflect the opinions of my $a $b."  |
| done; done                                                              |
+=========================================================================+


---------------------------------------------------------
To unsubscribe: send mail to ossig-request@mncc.com.my
with "unsubscribe ossig" in the body of the message