19

I need to store a large number of images (from around 10,000 images per day) With an average size of around 1 to 10 MB for each image.

I can store these images in MongoDB using the GridFS Library or by just storing the Base64 conversion as a string.

My question is that, is MongoDB suitable for such a payload or is it better to use a file system?

Many Thanks,

DafaDil
  • 2,463
  • 6
  • 23
  • 33
  • Seems to be a duplicate of [this question](http://stackoverflow.com/questions/6212990/mongodb-gridfs-vs-directly-disk-io). – Ben Siver May 09 '13 at 19:11
  • an alternative would be to have metadata of images in mongoDB and have the images themselves on something like S3 (+ optionally cloudfront) – Geert-Jan May 10 '13 at 14:16

2 Answers2

7

MongoDB GridFS has a lot of advantages over a normal file system and it is definitely able to cope with the amount of data you are describing as you can scale out with a sharded mongo cluster. I have not saved that much binary data in it on my own but I do not think there is a real difference between the binary data and text. So: yes, it is suitable for the payload.

Fabian
  • 2,428
  • 2
  • 21
  • 19
2

Implementing queries and operations on the file objects being saved is easier with GridFS. In addition, GridFS caters for backup/replication/scaling. However, serving the files is faster using Filesystem + Nginx than GridFS + Nginx(look here: https://www.coffeepowered.net/2010/02/17/serving-files-out-of-gridfs/). GridFS 'slower' serving speed can however be leveraged when sharding is used

Wedava
  • 1,211
  • 2
  • 16
  • 30