Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store millions of pictures about 2k each in size

We're creating an ASP.Net MVC site that will need to store 1 million+ pictures, all around 2k-5k in size. From previous ressearch, it looks like a file server is probably better than a db (feel free to comment otherwise).

Is there anything special to consider when storing this many files? Are there any issues with Windows being able to find the photo quickly if there are so many files in one folder? Does a segmented directory structure need to be created, for example dividing them up by filename? It would be nice if the solution would scale to at least 10 million pictures for potential future expansion needs.

like image 590
alchemical Avatar asked Dec 18 '22 01:12

alchemical


1 Answers

4Kb is the default cluster size for NTFS. You might tune this settings depending on usual picture size. http://support.microsoft.com/kb/314878

I would build a tree with subdirectories to be able to move from one FS to another : How many files can I put in a directory? and avoid some issues : http://www.frank4dd.com/howto/various/maxfiles-per-dir.htm

You can also have archives containing associated pictures to load them with only one file open. Thoses archives might be compressed is the bottleneck is I/O, uncompressed if it's CPU.

A DB is easier to maintain but slower... so it's up to you!

like image 184
Guillaume Avatar answered Dec 29 '22 11:12

Guillaume