Hi,
I was asked to create the application which will handle about 100 000 000
relatively small (about 1-2k) files. I decided to make a
multi-level directory tree, but I don't know which is the optimal number
of files in one directory. Is it 10, 100, 1000 or even more?
Someone told me that directory should be so small so all the entries fits
in directly adressed blocks - on 4kB block its 12*4kB = 48kB of space for
filenames, for short filenames its at least 1000 files in one directory.
Another guy told me thah directory should be so small so all the entries
fits in the first block. Its something about 200 short filenames in one
directory.
But if I create 14 directories each with 14 files, the average lookup time
will be 2 * 7 * time_to_explore_directory_entry + time_to_descend_into_dir
instead of 100 * time_to_explore_directory_entry. And I think that
time_to_descend_into_dir < 80 * time_to_explore_directory_entry. So its
better to create tree with many levels and only a few files in each
directory.
Am I right? Did I miss something?
Thanks in advance, please cc: on me, I am not in list.
Michal Pise