|
Posted by The Natural Philosopher on 09/04/07 11:19
Toby A Inkster wrote:
> 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.
>
Well thanks for he reply..I discovered that
1/. my ext3 filesystem uses a hashed btree index
2/. so does my database
3/. ergo, it was easier to stuff them direct in the database, or would
have been but for a weird issue that kept me up all last night. see
other thread.. I thought it was something simple, but it looks like deep
weirdness at the core of PHP to me..but then everything does untill you
find the explanation.
Navigation:
[Reply to this message]
|