On 23-Jun-00 Nicole Harrington. wrote:
>> > Yeah.. This is why databases where invented :) Hey I
>> agree... However even if the html was databased.. (working on that
>> now) the custom graphics cannot be. (yet)

On Fri, 23 Jun 2000 13:12:48 +0930 (CST), "Daniel O'Connor" <[EMAIL PROTECTED]> 
said:

Daniel> Hmm.. can't you do binary blobs in a DB and change the image
Daniel> URL's to be cgi requests?

I was considering this for a project I developed: web up/download of
lots of large files. I was using MySQL and some of the folks on that
list recommended not storing large files in the DB: even though the
disk consumption is the same, if it's in a DB you can't spread it
across partitions as space requirements grow.

So I store the file path in the DB and the actual file on the UNIX
filesystem. To reduce search time I use a two-level directory
hierarchy, each of which has 256 subdirectories. To distribute files
evenly, I store the file under a name which is the MD5 hash of the
filename, time, etc, etc. This gives me a 32-char name of [0-9a-f].

So if file foo.tar.gz hashes to name

        cafebabedeadbeef0123456789abcdef

it is stored under

        /filestore/ca/fe/cafebabedeadbeef0123456789abcdef

This gives me 256 * 256 = 65536 directories. My requirement was to
store at least 10 Million files, and this works out to about 150 files
per directory -- easy for UNIX to get to quickly. It's been working
very well for me.





To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to