Does a MongoDB MapReduce job lock the database? I am developing a multi-user MongoDB web application and am worried about multi-user conflicts and performance. Does anyone have any words of wisdom for me?
Simple answer? Sometimes ...
It depends a lot on how you are using map/reduce ... but in my experience it's never been a problem.
There isn't much info on this, but it's clearly stated in the docs that is does sometimes lock but it "Allows substantial concurrent operation."
There are a couple of questions in the mongodb-user group asking about this ... the best response I've seen offically is that ... "in 1.4 it yields but isn't as nice as it should be, in 1.5 its much friendlier to other requests."
That does not mean that it doesn't block at all, but compared to db.eval() which blocks the whole mongod process ... it's your best bet.
That said, in 1.7.2 and up there is now a nolock option for db.eval() ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With