Does MongoDB MapReduce lock the database

后端 未结 3 797
情书的邮戳
情书的邮戳 2021-02-14 09:50

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 hav

3条回答
  •  不知归路
    2021-02-14 10:33

    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() ...

提交回复
热议问题