SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Effect of disk space usage on filesystem functions()

    I'm currently using a caching system in one of my scripts. As it is a proxy, the cached content could grow indefinitely and so (with time) it will reach whatever limit I set. This could be a very big limit as the VPS I am currently on has about 100 GB of disk space available.

    My question is, will having a huge cache folder (significantly) slow down file operations? My first assumption was "of course - the more files it has to look through, the longer it takes" but now I'm not so sure.

    I would still think it must have an effect for scandir(), glob(), etc. and so I have avoided them. However, all I need is a single call to file_exists() and given the fact that it's a full known filename we're testing, does the size of the directory containing the file we're looking for have any effect on the time it takes to check?

    Many thanks.

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    When you search for files in a folder you don't actually search in the folder, you read a Master File Table that contains every folder and every file along with its permissions.

    I assume you are using linux which has a very good file management system and using the file system functions in PHP (scandir, glob) won't have a problem performing on huge amouth of data it is only the number of files that will slow it down.

    It won't be reading the files that is slow it would be putting them into an array in memory or performing search criteria on them.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, righto. I had no idea how it worked but that helps a lot.

    Yes, it's running on Linux (although developed on Windows). I'll stick with the current method and increase the filesize limit then..

    Many thanks logic_earth, much appreciated.


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
  •