MongoDB - How does locking work for Map Reduce?

Does the MongoDB card retain collection locks when performing operations on it?

I have some collections that are widely and intensively used by the application. A Map / Reduce runs in the background every 10 minutes through cron's work on this widely and heavily used collection.

I want to know if there is a high probability that Map / Reduce will not work well, because in this collection other operations are performed (inserts, updates, and mainly reading). In particular, I want to know if Map / Reduce affects the normal operations performed by users in the collection.

+4
source share
1 answer

MapReduce, if the output to the collection requires several write locks, as it writes (like any operation that creates / updates the collection). If you perform linear MR, then you avoid this blocking (but have size limits on the results). However, there are still read locks and Javascript locks (single-threaded for server-side JS on mongoDB right now).

All of this is explained (and will be updated if it changes) here:

http://www.mongodb.org/display/DOCS/How+does+concurrency+work#Howdoesconcurrencywork-MapReduce

Note. The problems of migrating the SpiderMonkey engine for V8 JS are those that keep track of that multithreading is what you are concerned about.

+1
source

Source: https://habr.com/ru/post/1403438/


All Articles