SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot mixDev's Avatar
    Join Date
    Mar 2004
    Location
    B'lore
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Best practice in maximum number of files in a directory

    Is there any limit in number of files in a directory? Will it slow down if I serve couple of thousand files from a single directory (through Apache on Linux). Anybody experienced such performance problems?

    I did a small apache bench test with 5000 requests with 1000 users and the requests persecond it can deliver is 69. I used 63K images in one directory and used one among them for the test. Is this makes any sense?
    HostAccord - Cheap RAID 10 Webhosting

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I have over 100,000 files in single directories without any performance problems.

  3. #3
    SitePoint Zealot mixDev's Avatar
    Join Date
    Mar 2004
    Location
    B'lore
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very much appreciated. But few questions.

    1) Whats the traffic?
    2) On linux?
    3) Will it be the same scenario if my PHP app does an fopen() on one file, do some processing and deliver the result through Apache?
    HostAccord - Cheap RAID 10 Webhosting

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    1) It's an image host serving several images per second. There are over 100,000 images in one directory.
    2) Yes. CentOS (RHEL) 4. Previously ran on CentOS 3.
    3) Image requests are redirected to a PHP script which records the request and readfile()'s the image through.

  5. #5
    SitePoint Zealot mixDev's Avatar
    Join Date
    Mar 2004
    Location
    B'lore
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perfect!
    HostAccord - Cheap RAID 10 Webhosting

  6. #6
    SitePoint Zealot mixDev's Avatar
    Join Date
    Mar 2004
    Location
    B'lore
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    After couple of years, I decided to shed some light on it =D

    Actually this problem was there in old *nix filesystems; the one used by one of my clients earlier. But right now with the ext3 filesystems these limitations have been removed. So, as of now, dont worry about hashed-tree directory structure and stuff. Just chill =D
    HostAccord - Cheap RAID 10 Webhosting


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
  •