且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

存储图像:MongoDb与文件系统

更新时间:2023-11-29 14:12:46

MongoDB GridFS与普通的文件系统相比有很多优点,它可以很好的处理你描述的数据量,因为你可以用一个分片的mongo集群进行扩展。我自己并没有在那里保存太多的二进制数据,但我不认为二进制数据和文本之间有真正的区别。所以:是的,它适合于有效载荷。


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,

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.