MongoDB:在没有并行性的情况下使用 MapReduce 有什么意义? [英] MongoDB: What's the point of using MapReduce without parallelism?

查看:11
本文介绍了MongoDB:在没有并行性的情况下使用 MapReduce 有什么意义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

引用 http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-Parallelism

截至目前,MapReduce 作业在单一的mongod进程是单一的螺纹.这是由于设计当前 JavaScript 的限制引擎.我们正在调查解决此问题的替代方法,但现在如果你想并行化您的 MapReduce 作业,您需要要么使用分片,要么做在您的代码中聚合客户端.

As of right now, MapReduce jobs on a single mongod process are single threaded. This is due to a design limitation in current JavaScript engines. We are looking into alternatives to solve this issue, but for now if you want to parallelize your MapReduce jobs, you will need to either use sharding or do the aggregation client-side in your code.

在没有并行性的情况下,与更简单或更传统的查询和数据聚合方法相比,MapReduce 有哪些优势?

Without parallelism, what are the benefits of MapReduce compared to simpler or more traditional methods for queries and data aggregation?

为避免混淆:问题不是面向文档的数据库相对于传统的关系数据库有什么好处"

To avoid confusion: the question is NOT "what are the benefits of document-oriented DB over traditional relational DB"

推荐答案

在更简单或更传统的查询上使用 MapReduce 的主要原因是它可以做一些简单查询不能做的事情(即聚合).

The main reason to use MapReduce over simpler or more traditional queries is that it simply can do things (i.e., aggregation) that simple queries cannot.

一旦您需要聚合,使用 MongoDB 有两个选项:MapReduce 和 group 命令.group 命令类似于 SQL 的group by",其局限性在于它必须在单个数据库响应中返回其所有结果.这意味着只有当您的结果少于 4MB 时才能使用组.另一方面,MapReduce 可以做任何分组依据"可以做的事情,但会将结果输出到新集合,因此结果可以根据需要大.

Once you need aggregation, there are two options using MongoDB: MapReduce and the group command. The group command is analogous to SQL's "group by" and is limited in that it has to return all its results in a single database response. That means group can only be used when you have less than 4MB of results. MapReduce, on the other hand, can do anything a "group by" can, but outputs results to a new collection so results can be as large as needed.

另外,并行性即将到来,所以最好有一些练习:)

Also, parallelism is coming, so it's good to have some practice :)

这篇关于MongoDB:在没有并行性的情况下使用 MapReduce 有什么意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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