在Mongo GridFS或Amazon S3中存储图像之间哪个更快?

时间:2022-11-26 23:03:18

I am working on a project, where each user can post many images. We use Node.js with Express and MongoDB as the database. I was wondering which way would be better in terms of speed and scalability:

我正在开发一个项目,每个用户都可以发布许多图像。我们将Node.js与Express和MongoDB一起用作数据库。我想知道哪种方式在速度和可扩展性方面会更好:

  • Storing images in Mongo GridFS
  • 在Mongo GridFS中存储图像

Or

要么

  • Storing images on Amazon S3, and paths of images on MongoDB. Then retrieve images using paths.
  • 在Amazon S3上存储图像,以及MongoDB上的图像路径。然后使用路径检索图像。

Any thoughts are appreciated !

任何想法都表示赞赏!

Thank you,

谢谢,

1 个解决方案

#1


16  

This is like comparing Go vs Node.js. There's no better general solution.

这就像比较Go vs Node.js.没有更好的通用解决方案。

Each might have their own advantages and solutions. MongoDB is more like the DIY solution, and Amazon S3 is the managed solution. With MongoDB you have to scale it yourself. I can say S3 will be faster initially and it's already scaled by Amazon, and probably cheaper(S3 is cheaper than EBS). You can get a lot of servers with huge amounts of RAM and MongoDB will definitely be faster. Also if the MongoDB instance is in the same instance as your App, you will have less latency.

每个人都有自己的优势和解决方案。 MongoDB更像是DIY解决方案,而Amazon S3是托管解决方案。使用MongoDB,您必须自己扩展它。我可以说S3最初会更快,它已经被亚马逊缩放,可能更便宜(S3比EBS便宜)。你可以获得大量具有大量RAM的服务器,MongoDB肯定会更快。此外,如果MongoDB实例与您的应用程序位于同一实例中,则延迟时间会减少。

Also check this question: MongoDB as static files provider?

还要检查这个问题:MongoDB作为静态文件提供程序?

And this: What are the advantage of using MongoDB GridFS vs Amazon S3 to store assets for a product with MongoDB as the database backend?

这就是:使用MongoDB GridFS和Amazon S3来存储MongoDB作为数据库后端的产品的资产有什么好处?

#1


16  

This is like comparing Go vs Node.js. There's no better general solution.

这就像比较Go vs Node.js.没有更好的通用解决方案。

Each might have their own advantages and solutions. MongoDB is more like the DIY solution, and Amazon S3 is the managed solution. With MongoDB you have to scale it yourself. I can say S3 will be faster initially and it's already scaled by Amazon, and probably cheaper(S3 is cheaper than EBS). You can get a lot of servers with huge amounts of RAM and MongoDB will definitely be faster. Also if the MongoDB instance is in the same instance as your App, you will have less latency.

每个人都有自己的优势和解决方案。 MongoDB更像是DIY解决方案,而Amazon S3是托管解决方案。使用MongoDB,您必须自己扩展它。我可以说S3最初会更快,它已经被亚马逊缩放,可能更便宜(S3比EBS便宜)。你可以获得大量具有大量RAM的服务器,MongoDB肯定会更快。此外,如果MongoDB实例与您的应用程序位于同一实例中,则延迟时间会减少。

Also check this question: MongoDB as static files provider?

还要检查这个问题:MongoDB作为静态文件提供程序?

And this: What are the advantage of using MongoDB GridFS vs Amazon S3 to store assets for a product with MongoDB as the database backend?

这就是:使用MongoDB GridFS和Amazon S3来存储MongoDB作为数据库后端的产品的资产有什么好处?