|
Posted by Toby A Inkster on 09/04/07 07:48
The Natural Philosopher wrote:
> I suspect the answer is that for n files, us the pth root of n as the
> number of subdirs, where p is the depth of the subdirs...but a lot
> depends on caching algorithms in the directories. AND the way the OS
> searches them.
Look at the way mail queue and news spools work. This is software that has
to maintain a large number of smallish files, which have to be created and
deleted a lot, but very rarely modified. That sounds like roughly what you
want to do.
For a piece of mail queued with ID A1B2C3D4 it would store it in:
/var/spool/postfix/deferred/A/A1B2C3D4
That is, it stores it in sub-directories based on the first character of
the queue ID. For larger numbers of files, you could go even further:
/var/spool/postfix/deferred/A/A1/A1B2C3D4
An important aspect of this is that queue IDs are eight-digit codes
assigned pseudo-randomly rather than sequentially, so you don't end up with
a directory called "/1/" brimming with files, and a directory called "/2/"
which is almost empty.
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 75 days, 11:19.]
TrivialEncoder/0.2
http://tobyinkster.co.uk/blog/2007/08/19/trivial-encoder/
Navigation:
[Reply to this message]
|