MongoDB的静态文件的提供者? [英] MongoDB as static files provider?

查看:178
本文介绍了MongoDB的静态文件的提供者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是MongoDB的一个很好的候选人为静态文件(文件,视频)的CDN。我搜索了坚实的方式来存储大数据量(> +要)remplacing S3和管理缓存功能。 经验。

It's MongoDB a good candidate to serve static files (files, video) as cdn. I searching a solid way to store big amounts of data (>+To) remplacing S3 and managing cache features. Experiences.

感谢。

推荐答案

我假设这个问题的答案是,因为当你使用CDN来存储静态文件,你让你的服务器不受静态数据的请求。但是,当你的文件系统和MongoDB的II的都选择假设的MongoDB会更快,东阳,如果有足够的内存在服务器上,蒙戈将所有的数据加载到内存中。

I suppose that the answer to this question is no, because when you are using a CDN to store static files you make your server free from static data requests. But when you are choosing between a file system and mongodb Ii suppose that mongodb will be faster, beacause if there is enough ram on the server, mongo will load all data to the memory.

另外,我发现一些链接,可以帮助你做出你的选择: WWW .markus-gattol.name ,<一个href="http://groups.google.com/group/mongodb-user/browse_thread/thread/907b465a162df731/f8182309f1213372?show_docid=f8182309f1213372"相对=nofollow> groups.google.com

Also I've found some links that can help you make your choice: www.markus-gattol.name, groups.google.com

从文档:

何时使用GridFS的

大量的文件。 GridFS的往往处理大量(成千上万)   的文件比许多文件更好   系统。

Lots of files. GridFS tends to handle large numbers (many thousands) of files better than many file systems.

用户上传的文件。当用户上传的文件,你往往有很多   文件,并希望他们复制和   备份。 GridFS的是一个完美的地方   存储这些的话,你可以管理   他们所管理的方式相同的   数据。您还可以通过用户的查询,   在上传日期等...直接   文件存储,没有一层   间接

User uploaded files. When users upload files you tend to have a lot of files, and want them replicated and backed up. GridFS is a perfect place to store these as then you can manage them the same way you manage your data. You can also query by user, upload date, etc... directly in the file store, without a layer of indirection

文件经常改变。如果你有一些经常变化的某些文件 -   这是有道理的将它们存储在GridFS的   这样你就可以修改它们在同一个地方   和所有客户端将得到更新。   也可以比存储在更好   源代码树,这样你就不必   部署应用程序更新文件。

Files that often change. If you have certain files that change a lot - it makes sense to store them in GridFS so you can modify them in one place and all clients will get the updates. Also can be better than storing in source tree so you don't have to deploy app to update files.

当不使用GridFS的

几个小的静态文件。如果你只是有一个几个小文件   网站(JS,CSS,图像),它可能   更容易只是使用的文件系统。

Few small static files. If you just have a few small files for a website (js,css,images) its probably easier just to use the file system.

请注意,如果你需要原子地更新二进制对象,以及   对象是根据文件的大小   限制你的MongoDB版本   (16MB为1.8),那么你可能   考虑手动存储对象   在单个文档。这可以是   使用BSON bindata完成   类型。检查驱动程序的文档进行   在使用这种类型的详细信息。

Note that if you need to update a binary object atomically, and the object is under the document size limit for your version of MongoDB (16MB for 1.8), then you might consider storing the object manually within a single document. This can be accomplished using the BSON bindata type. Check your driver's docs for details on using this type.

这篇关于MongoDB的静态文件的提供者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆