SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hashing directories - when is this recommended?

    I am writing some scripts that are going to cache output into files which will need to be stored together into directories. The directories will be created dynamically by the script. Then daily I am going to run a cron job to delete the cached files (and directories). This is on a i686 running RedHat 7.1

    So. I am just wondering, is there a rule of thumb for working out what the optimal hashing scheme is for directories in the files system???

    For example, if I expect to create say 1000 directories all under the cache-data directory, what level of hashing should I use for the directory structure?

    None? One level, two, ...? Is there an algorithm? I'm not very good with data structures such as trees.


  2. #2
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you mean? I'm confused, the only hashing I know is for indexing and hash functions.

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK well my ignorance is shining through. I'm not talking about anything complicated like messing with the actual file system itself (its ext2 BTW). Just that I know that in general when you are creating, say lots of virtual server doc roots or virtual maildirs, etc, you often "hash" them out (if hash is the correct term to use in this context) using a crude method.

    Example,
    Code:
    a/
       abanathy/
       almond/  
       apple/
    /b
       bah/
       banana/
       boobies/
    
    etc
    
    Add another level to the hashing:
    
    a/
      ab/
        aboriginie/
        abooboo/
      al/
        almond/
        alarmist/
    
     etc

    So, there must be some rule of thumb or algorithm that ppl use here to decide to what level of hashing out of directories produces the optimal balanced tree strucure in the file system.

    Last edited by freakysid; Apr 11, 2002 at 14:34.


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
  •