Thread: ext3 directory limit
-
19-07-2008 06:35 PM #1
ext3 directory limit
Just reworking the PSB image caching so that it works in the background instead of when you make the post as large posts with lots of images bomb out.
We are currently at 2700 odd cached images after 2 weeks and am looking to come up with some form of directory structure for storing them.
Reading here ext3 - Wikipedia, the free encyclopedia
The maximum number of inodes (and hence the maximum number of files and directories) is set when the file system is created. If V is the volume size in bytes, then the default number of inodes is given by V/213 (or the number of blocks, whichever is less), and the minimum by V/223. The default was deemed sufficient for most applications. The max number of subdirectories in one directory is fixed to 32000.
Im thinking of a folder structure like this..
images/year/forum_id/thread_id/img_id-original-filename.ext
Hopefully including the year and forumID would overcome when we get more than 32k threads with images in a year.
Can anyone see any flaw in this?My Turbo Build
Thanks to Sponsors:
Motorcycle Panel & Paint
Q-Zar Fremantle
Rated-R Parts
PerthStreetBikes.com and it's generous members
Carlisle Printing - Deals for PSB members
CIC - Competition & Industrial Coatings
Carpet Liquidators - Midland
-
19-07-2008 08:28 PM #2
Looked into any of the alternative filesystems?
I know EXT4 overcomes the 32k subdirectory limit, but its not really production ready yet.
I hear Reiser is a killer filesystem....
edit:
I guess what I'm saying is that if it was me, i'd take the lazy way out and move the complexity out of the app and into the filesystem... not having seen the forum code i've got no idea how much hacking you'll have to do otherwise?
-
19-07-2008 09:38 PM #3
-
19-07-2008 09:47 PM #4
It's all custom code so complexity isn't an issue, just a matter of specifying a different file path and of course some logic to create the directory if it doesn't exist.
ie
$start_dir = "/home/psb/www/imgcache/".date("Y")."/".$forum_id."/".$thread_id."/";
if(!is_dir($start_dir))
{
mkdir($start_dir, 0777,1);
}
I'd rather not have to fuck around with filesystems as it's just another thing to do when an upgrade occurs.
Basically i can over come the limit with folder structures but just wanted to be sure.My Turbo Build
Thanks to Sponsors:
Motorcycle Panel & Paint
Q-Zar Fremantle
Rated-R Parts
PerthStreetBikes.com and it's generous members
Carlisle Printing - Deals for PSB members
CIC - Competition & Industrial Coatings
Carpet Liquidators - Midland
-
19-07-2008 09:49 PM #5
lol, the forum strips out variables... what use is the php bbcode then.
My Turbo Build
Thanks to Sponsors:
Motorcycle Panel & Paint
Q-Zar Fremantle
Rated-R Parts
PerthStreetBikes.com and it's generous members
Carlisle Printing - Deals for PSB members
CIC - Competition & Industrial Coatings
Carpet Liquidators - Midland
-
19-07-2008 10:11 PM #6
store it all as binary in a db? (just thinking out loud)
If you can... you MUST!
-
19-07-2008 10:14 PM #7
contemplated that, just worried about cpu. however it may be the best way for when we bring multiple servers online.
My Turbo Build
Thanks to Sponsors:
Motorcycle Panel & Paint
Q-Zar Fremantle
Rated-R Parts
PerthStreetBikes.com and it's generous members
Carlisle Printing - Deals for PSB members
CIC - Competition & Industrial Coatings
Carpet Liquidators - Midland
-
19-07-2008 10:22 PM #8
Once again... thinking out loud here... mount an NTFS disk for storage?
If you can... you MUST!
-
19-07-2008 10:22 PM #9
-
19-07-2008 10:23 PM #10
-
19-07-2008 10:25 PM #11
Actually no...
My last employment saw a system storing a bazillion small files and the engineers of the system had it on an NTFS drive specifically. Believe it or not... it worked.If you can... you MUST!
-
19-07-2008 10:29 PM #12
-
19-07-2008 10:33 PM #13
There is a Linux NTFS-3G driver which would do the job. Now I wasnt saying that it was the best option... or even a good one. It was a thinking outside of the box (which I do quite often).
The maximum number of files on an NTFS volume is 4,294,967,295. Which would fit the bill on that attribute.If you can... you MUST!
-
19-07-2008 11:08 PM #14
Actually,think i might try this option for a bit and see how it goes.
Test shows no performance hit.
Comparison between storing images/files in mySQL and on filesystem. | Sitek Technology BlogMy Turbo Build
Thanks to Sponsors:
Motorcycle Panel & Paint
Q-Zar Fremantle
Rated-R Parts
PerthStreetBikes.com and it's generous members
Carlisle Printing - Deals for PSB members
CIC - Competition & Industrial Coatings
Carpet Liquidators - Midland
-
19-07-2008 11:17 PM #15
Excuse me for being dumb, but can you store it in the users name who posted it under a common named file in their profile?
-
19-07-2008 11:19 PM #16
^^ i guess you could.
but then you'd perhaps be open to some user deciding to upload 32,769 1 pixel images just to be a pratt
-
20-07-2008 03:48 PM #17
^^At which point you ban their arses for being said pratt. If someone is malicious enough to do that then do ya really want them on your site anyway?
-
27-07-2008 01:46 PM #18
Well it's now running in parallel with the file system. The good part of this is being able to index them by forum, user, thread, etc etc Will make for a good image gallery based purely on what has been posted aswell as be able to provide a friendly path ie
Also discovered that wsftp won't list over 3k files in a directory as we are now at 4500+ images and it will only show me 3k of themCode:http://www.perthstreetbikes.com/30/Dream-garage/IMG_1010.sized.jpg
My Turbo Build
Thanks to Sponsors:
Motorcycle Panel & Paint
Q-Zar Fremantle
Rated-R Parts
PerthStreetBikes.com and it's generous members
Carlisle Printing - Deals for PSB members
CIC - Competition & Industrial Coatings
Carpet Liquidators - Midland
-
27-07-2008 02:11 PM #19
Granted, but it still doesn't stop it happening in the first place, either through accident, negligence or malice.
Or script from backpackistan hacker cafe, or whatever.
You don't design systems with the mindset of "nah, no one would ever do that to me?", or you'll get fucked
-
28-07-2008 09:33 AM #20
Ahh actually come to think of it bro, you will run into problems with shell commands before you run into file system limitations.
We had a system where I used to work, that had a crap load of files (in the 1000's) and it wasnt before long that we started having major problems with commands like: ls, grep, rm etc.
The filesystem didnt seem to have any problems adding more and more files to the directory... but it started becoming very difficult to manage the files inside of the directory.
Even if we piped ls thru grep for a particular date or file... grep still has to parse the entire ls listing before it can give you the output.If you can... you MUST!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Speed limit ideas anyone?
By faultykyle in forum Yada Yada YadaReplies: 84Last Post: 29-05-2008, 03:53 PM -
48hrs for 107 over limit...
By Billywhizz in forum News FlashReplies: 91Last Post: 28-12-2007, 08:35 PM -
Mailbox limit
By Gryphen in forum HELP DESKReplies: 14Last Post: 16-10-2007, 12:59 AM -
Directory Assistance
By CBillyR in forum Yada Yada YadaReplies: 8Last Post: 01-02-2006, 03:48 PM -
Get On Up - No Limit Exteme Entertainment
By Melkor in forum Mods, Being Technamikle & Product ReviewsReplies: 11Last Post: 14-07-2004, 06:52 PM




LinkBack URL
About LinkBacks




Reply With Quote















Bookmarks