Uche Ozoemena
Uche Ozoemena

Reputation: 926

Does a running MongoDB aggregation pipeline slow down reads and writes to the affected collection?

As the title suggests, I'd like to know if reads and writes to a collection are delayed/paused while a MongoDB aggregation pipeline is running. I'm considering adding a pipeline in a user collection, and I think the query could sometimes affect a lot of users (possibly tens of thousands), or just run for longer than I expect. So I'm wondering if that will "block" reads and writes to the collection. The server isn't live, so I don't have real user data to inform this decision. I'd appreciate any feedback or suggestions, thanks!

Upvotes: 0

Views: 157

Answers (1)

D. SM
D. SM

Reputation: 14520

Each server has certain resource capacity. If you are sending a query to the server, it has less capacity remaining to do other work (be that other queries or writes).

For locking and concurrency in MongoDB, see https://docs.mongodb.com/manual/faq/concurrency/.

If you are planning for high load/high throughput you need to benchmark your specific use case.

Upvotes: 1

Related Questions