Question

I have a busy photo website that has approximately 350,000 photos. The high resolution, downloadable photos are stored in an Amazon S3 Bucket but the thumbnails and previews are stored on my dedicated server.

Currently, I have 350,000 thumbnails in 1 photo folder and the site is growing fast. Am I better off leaving all thumbnails in 1 folder, that could reach a few million, or should I start programatically scaling a folder structure like; photo1, photo2, photo3 and have 100k files in each folder?

Was it helpful?

Solution

Definately split them out into a folder structure. One approach that I find useful is to set the folder structure as substrings of the file name.

e.g. 23155104112.jpg:

..\231
..\231\551
..\231\551\041
..\231\551\041\23155104112.jpg

This way you don't need to store additional path data, the files are always where you expect them, and you never end up with too many files in a folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top