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

查看:95
本文介绍了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天全站免登陆