Is the aggregation framework introduced in mongodb 2.2, has any special performance improvements over map/reduce?
If yes, why and how and how much?
(Already I have done a test for myself, and the performance was nearly same)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Every test I have personally run (including using your own data) shows aggregation framework being a multiple faster than map reduce, and usually being an order of magnitude faster.
Just taking 1/10th of the data you posted (but rather than clearing OS cache, warming the cache first – because I want to measure performance of the aggregation, and not how long it takes to page in the data) I got this:
MapReduce: 1,058ms
Aggregation Framework: 133ms
Removing the $match from aggregation framework and {query:} from mapReduce (because both would just use an index and that’s not what we want to measure) and grouping the entire dataset by key2 I got:
MapReduce: 18,803ms
Aggregation Framework: 1,535ms
Those are very much in line with my previous experiments.