I need to store some 100K files, based on user's contact number. Consider the contact number to be 10 digits like (1234567890). On some external event, my process shall be retrieve user information based on the user's contact number.
Option-1: Store the user's information in /files/1/2/3/4/5/6/7/8/9/0/1234567890.txt directory structure.
Option-2: Hash user's contact number and store the user-information files in two level directory structure. The first level shall contain some 100 directories and the second level another 100 directories. Therefore given the contact number, there shall be a hashing algorithm which shall return the user information folder.
(e.g) /files/80/40/1234567890.txt
Can anyone please let me know on, which option is better, with respect to linux filesystem/inode performance and let me know the reason why?
I want to organize the files based on the user's contact number, so that the retrieval can be really faster. The number of files could be around some 5 millions.