+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 22
  1. #1
    Staff TYSON's Avatar
    Join Date
    Apr 2004
    Location
    Sweatshop
    Posts
    11,954

    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

  2. #2
    Member thro's Avatar
    Join Date
    Jun 2006
    Location
    Ashfield
    Posts
    16,869
    Blog Entries
    4
    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?

  3. #3
    Member MikeC's Avatar
    Join Date
    Jun 2007
    Location
    Scabs
    Posts
    1,220

    +1 if it's a limit you realistically expect to see reached, use a different filesystem. It'll save untold pain later.
    Quote Originally Posted by zobo View Post
    I'd be more prolific in answering but I thought of a use for the othe

  4. #4
    Staff TYSON's Avatar
    Join Date
    Apr 2004
    Location
    Sweatshop
    Posts
    11,954

    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

  5. #5
    Staff TYSON's Avatar
    Join Date
    Apr 2004
    Location
    Sweatshop
    Posts
    11,954

    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

  6. #6
    Administrator Klink's Avatar
    Join Date
    Dec 2003
    Location
    PSB Cafe Basement
    Posts
    6,231

    store it all as binary in a db? (just thinking out loud)
    If you can... you MUST!

  7. #7
    Staff TYSON's Avatar
    Join Date
    Apr 2004
    Location
    Sweatshop
    Posts
    11,954

    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

  8. #8
    Administrator Klink's Avatar
    Join Date
    Dec 2003
    Location
    PSB Cafe Basement
    Posts
    6,231

    Once again... thinking out loud here... mount an NTFS disk for storage?
    If you can... you MUST!

  9. #9
    Member MikeC's Avatar
    Join Date
    Jun 2007
    Location
    Scabs
    Posts
    1,220

    Could you not just re-format a partition EXT4 and mount it as the images directory? i'm aware i'm probably solving a problem you don't have here but...
    Quote Originally Posted by zobo View Post
    I'd be more prolific in answering but I thought of a use for the othe

  10. #10
    Member MikeC's Avatar
    Join Date
    Jun 2007
    Location
    Scabs
    Posts
    1,220

    Quote Originally Posted by Klink View Post
    Once again... thinking out loud here... mount an NTFS disk for storage?
    BWAHAHAHAHAHAHAHAHAHAHAHA!!!!!!!two!!!




    You are joking, right
    Quote Originally Posted by zobo View Post
    I'd be more prolific in answering but I thought of a use for the othe

  11. #11
    Administrator Klink's Avatar
    Join Date
    Dec 2003
    Location
    PSB Cafe Basement
    Posts
    6,231

    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!

  12. #12
    Member MikeC's Avatar
    Join Date
    Jun 2007
    Location
    Scabs
    Posts
    1,220

    Well shit.


    i wouldn't have relied 1) on NTFS to do anything right at the extremes of performance, or 2) on a write mounted NTFS partition from anything *NIX. i guess i'll have to look again.
    Quote Originally Posted by zobo View Post
    I'd be more prolific in answering but I thought of a use for the othe

  13. #13
    Administrator Klink's Avatar
    Join Date
    Dec 2003
    Location
    PSB Cafe Basement
    Posts
    6,231

    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!

  14. #14
    Staff TYSON's Avatar
    Join Date
    Apr 2004
    Location
    Sweatshop
    Posts
    11,954

    Quote Originally Posted by Klink View Post
    store it all as binary in a db? (just thinking out loud)
    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 Blog
    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

  15. #15
    Member XSorXpire's Avatar
    Join Date
    May 2006
    Location
    out of left field
    Posts
    10,223
    Blog Entries
    72
    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?

  16. #16
    Member thro's Avatar
    Join Date
    Jun 2006
    Location
    Ashfield
    Posts
    16,869
    Blog Entries
    4
    ^^ 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

  17. #17
    Member
    Join Date
    May 2004
    Location
    Palmyra/Attadale
    Posts
    515
    ^^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?

  18. #18
    Staff TYSON's Avatar
    Join Date
    Apr 2004
    Location
    Sweatshop
    Posts
    11,954

    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

    Code:
    http://www.perthstreetbikes.com/30/Dream-garage/IMG_1010.sized.jpg
    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 them
    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. #19
    Member thro's Avatar
    Join Date
    Jun 2006
    Location
    Ashfield
    Posts
    16,869
    Blog Entries
    4
    Quote Originally Posted by JiggyJigs View Post
    ^^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?

    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

  20. #20
    Administrator Klink's Avatar
    Join Date
    Dec 2003
    Location
    PSB Cafe Basement
    Posts
    6,231

    Quote Originally Posted by TYSON View Post
    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

    Code:
    http://www.perthstreetbikes.com/30/Dream-garage/IMG_1010.sized.jpg
    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 them
    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

  1. Speed limit ideas anyone?
    By faultykyle in forum Yada Yada Yada
    Replies: 84
    Last Post: 29-05-2008, 03:53 PM
  2. 48hrs for 107 over limit...
    By Billywhizz in forum News Flash
    Replies: 91
    Last Post: 28-12-2007, 08:35 PM
  3. Mailbox limit
    By Gryphen in forum HELP DESK
    Replies: 14
    Last Post: 16-10-2007, 12:59 AM
  4. Directory Assistance
    By CBillyR in forum Yada Yada Yada
    Replies: 8
    Last Post: 01-02-2006, 03:48 PM
  5. Get On Up - No Limit Exteme Entertainment
    By Melkor in forum Mods, Being Technamikle & Product Reviews
    Replies: 11
    Last Post: 14-07-2004, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Content Relevant URLs by vBSEO 3.5.0 RC3