GridFS 对于生产来说是否足够快速和可靠? [英] Is GridFS fast and reliable enough for production?

查看:29
本文介绍了GridFS 对于生产来说是否足够快速和可靠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个新网站,我想使用 GridFS 作为所有用户上传的存储,因为与普通文件系统存储相比,它提供了很多优势.

nginx 提供的 GridFS 基准测试表明,它不如 nginx 提供的普通文件系统快.

使用 nginx 进行基准测试

是否有人已经在生产环境中使用了 GridFS,或者将其用于新项目?

解决方案

我在我们的一台服务器上使用 gridfs,该服务器是价格比较网站的一部分,具有可观的流量统计数据(每天大约有 25,000 名访问者).服务器没有多少内存,2gigs,甚至 cpu 也不是很快(Core 2 duo 1.8Ghz),但服务器有足够的存储空间:raid 0 配置中的 10Tb (sata).服务器所做的工作非常简单:

我们的价格比较器上的每个产品都有一个图像(根据我们的产品数据库,大约有 1000 万种产品),服务器的工作是下载图像,调整大小,将其存储在 gridfs 上,然后将其交付给访问者浏览器...如果它不存在于网格中...或者...如果它已经存储在网格中,则将其传递给访问者浏览器.因此,这可以称为传统 CDN 架构".

自从该服务器启动并运行以来,我们已经在该服务器上存储和处理了 400 万张图像.调整大小和存储的东西是由一个简单的 php 脚本完成的......但可以肯定的是,python 脚本或类似 java 的东西可能会更快.

当前数据大小:11.23g

当前存储大小:12.5g

指数:5

索引尺寸:849.65m

关于可靠性:这是非常可靠的.服务器不加载,索引大小正常,查询速度快

关于速度:当然,是不是没有本地文件存储快,可能慢10%,但足够快,即使需要处理图像也可以实时使用,在我们的例子中,非常依赖php.维护和开发时间也减少了:删除单个或多个图像变得如此简单:只需使用简单的删除命令查询数据库即可.另一个有趣的事情:当我们重新启动我们的旧服务器时,当我们使用本地文件存储(数千个文件夹中有数百万个文件)时,它有时会挂起几个小时,因为系统正在执行文件完整性检查(这真的花了几个小时......).我们不再有 gridfs 的这个问题,我们的图像现在存储在大 mongodb 块(2gb 文件)中

所以......在我看来......是的,gridfs 足够快速和可靠,可以用于生产.

I develop a new website and I want to use GridFS as storage for all user uploads, because it offers a lot of advantages compared to a normal filesystem storage.

Benchmarks with GridFS served by nginx indicate, that it's not as fast as a normal filesystem served by nginx.

Benchmark with nginx

Is anyone out there, who uses GridFS already in a production environment, or would use it for a new project?

解决方案

I use gridfs at work on one of our servers which is part of a price-comparing website with honorable traffic stats (arround 25k visitors per day). The server hasn't much ram, 2gigs, and even the cpu isn't really fast (Core 2 duo 1.8Ghz) but the server has plenty storage space : 10Tb (sata) in raid 0 configuration. The job the server is doing is very simple:

Each product on our price-comparer has an image (there are around 10 million products according to our product db), and the servers job is to download the image, resize it, store it on gridfs, and deliver it to the visitors browser... if it's not present in the grid... or... deliver it to the visitors browser if it's already stored in the grid. So, this could be called as a 'traditional cdn schema'.

We have stored and processed 4 million images on this server since it's up and running. The resize and store stuff is done by a simple php script... but for sure, a python script, or something like java could be faster.

Current data size : 11.23g

Current storage size : 12.5g

Indices : 5

Index size : 849.65m

About the reliability : This is very reliable. The server doesn't load, the index size is ok, queries are fast

About the speed : For sure, is it not fast as local file storage, maybe 10% slower, but fast enough to be used in realtime even when the image needs to be processed, which is in our case, very php dependant. Maintenance and development times have also been reduced: it became so simple to delete a single or multiple images : just query the db with a simple delete command. Another interesting thing : when we rebooted our old server, with local file storage (so million of files in thousands of folders), it sometimes hangs for hours cause the system was performing a file integrity check (this really took hours...). We do not have this problem any more with gridfs, our images are now stored in big mongodb chunks (2gb files)

So... on my mind... Yes, gridfs is fast and reliable enough to be used for production.

这篇关于GridFS 对于生产来说是否足够快速和可靠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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