[CentOS] Regarding LARGE number of files in a folder in linux

Thu Jul 9 17:14:54 UTC 2009
Stephen Harris <lists at spuddy.org>

On Thu, Jul 09, 2009 at 01:04:37PM -0400, Bob Hoffman wrote:
> If you have 300,000 clients you could give them their own folder each and
> then the folders would have only 10 photos, but one folder would contain
> 300,000 folders.

No.  Because that top level folder would be split by first letter, or
by first and second letter
eg
"fred" would be f/r/fred   (or  f/r/ed)
"harry" would be h/a/harry (or  h/a/rry)

If you find there's too much clumping then (eg you have a lot of people
beginning "fr"), you hash the name instead, and then split on the hash.
(A simple hash could just be an incrementing number - "userid").

Then you simply program the web server to automatically convert from
friendly name to split (or split hash'd) name.  So it _looks_ like
everyone has names like "fred" and "harry" but your directory structure
is a lot more efficient.

> SO what is best for file management and system resources?

Best is subjective.  I've just described _one_ method.

-- 

rgds
Stephen