Storing lots of files
Originally I was planning to store the images on a shared file system, where the webserver and app servers could access the images. I was planning on creating a dir structure based on the user id uploading the image and breaking the long into /xxx/yyy/zzz/image.png. Then storing the photo info into the db.
The problem with the file system approach, is that I can see moving this file system with millions of files can be unwieldy.
Then I started to think about storing them in a database either mysql or mongodb. Using a Master slave setup where the writes are stored to the master as blobs and then then read by an app to serve out the image. I was thinking of using caching in front of the db, either a memcache setup for the thumbnails or creating a cache by writing to the local disk for serving up the image.
I am soliciting any other ideas on how to best handle this situation, Any ideas. Thanks