Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Most efficient file storage layout...

images php coding issues or problems here.

Moderators: macek, egami, gesf

Most efficient file storage layout...

Postby abudabit » Sat Jun 26, 2004 10:59 am

I want to have image storage on my website and want to plan an efficient method just in case there are a lot of users.

Would it take too long for the system to seach for a file if there are 10000's of files in one directory? Would it be faster if I had a bunch of directories referenced by a random directory name in the database, such as "images/fdasfd123ds/filename.***" instead of "images/filename.***"? Or to take it further, two levels of random directory names such as "images/fdafs/fdafsd/filename.***"? I don't know enough about operating systems to know if any of this matters.

I'm sure someone here has dealt with this before, everyone here seems really knowledgable. Thanks in advance.
abudabit
New php-forum User
New php-forum User
 
Posts: 17
Joined: Sat May 29, 2004 3:07 pm

Re: Most efficient file storage layout...

Postby swirlee » Sat Jun 26, 2004 11:48 am

abudabit wrote:Would it take too long for the system to seach for a file if there are 10000's of files in one directory? Would it be faster if I had a bunch of directories referenced by a random directory name in the database, such as "images/fdasfd123ds/filename.***" instead of "images/filename.***"? Or to take it further, two levels of random directory names such as "images/fdafs/fdafsd/filename.***"? I don't know enough about operating systems to know if any of this matters.


This is actually a pretty good question. But the answer is highly dependent upon which filesystem you're using. Some filesystems are optimized for very large files, some filesystems are optimized for a lot of small files, and some are somewhere in the middle.

I recommend that you first figure out what filesystem you're using. If you're on Windows NT/2000/XP it's probably NTFS. If you're on Win98 or Me, it's probably FAT16 or FAT32, and you seriously shouldn't be using it anyway. Upgrade. If you're on a Mac, it's probably HFS. And if you're on *nix, well, then it could be anything. Ext2fs, JFS, ReiserFS, etc. Once you figure out what you're working with, Google it. You can probably find some good information in the Filesystems HOWTO.
User avatar
swirlee
Moderator
Moderator
 
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back

Postby abudabit » Sat Jun 26, 2004 1:10 pm

Unfortunatly I'm using a free test server before I go on to a real host, so I don't have that info yet. I guess I'll do 3 layers of directories with 50 name posibilities each. 125000 different end directories is probably enough unless I get like 50Million files which will probably never happen. And if it does I guess I could change it to 80 name posibilities each. Of course this is all speculation.

I do notice that Windows XP has a problem with hundreds of files in a folder although that might be more of a GUI issue.

Thanks.
abudabit
New php-forum User
New php-forum User
 
Posts: 17
Joined: Sat May 29, 2004 3:07 pm


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.