I’ve to perform a map reduce operation with a clustering algorithm of a large amount of data.
I’ve choose MongoDB for its scalability, great docs, BSon documents storage and many other great features.
But, the map-reduce operation is too slow. Only one core of my quadcore CPU is used.


I read this document and I understand that is a JavaScript’s fault.
“Only one thread in the mongod process executes Javascript at a time”
How can I improve that? Improving IO speed?
- SSD storage may be useful?
- Load the whole MongoDB’s data on RAM?
Otherwise bottleneck is only the CPU and the mono-thread algorithm, so I have to re-write my algorithm in another language, outside Mongo, to take advantage of multi-threading and multi-processing?
The issue is that there is no parallelization of work while Mongo is using Spidermonkey as its js engine. There is a long term plan to move to V8 to allow multi-threaded execution of js tasks, but it won’t make the next release (2.2).
Some of the slowness with map/reduce will be improved in 2.2 for people who will be able to switch to the new aggregation framework instead of map/reduce. Unfortunately it doesn’t sound like that will help you since you are using custom algorithm and not just aggregation computations.