Reputation: 3353
Imagine one database collection with many records (traffic data) and 2 separate services that are using it.
First service just reads data using aggregation framework and it takes pretty long because not every fields are indexed, so lets say it generates lots of reads on that collection. This reads are done every 15 minutes.
Second service is usually doing nothing but in some moment it can also start doing lots of aggregation queries and in other moment lots of update queries.
My question is: Does reads from first service has any kind of side-effect on second service i.e does it slows down second service. Same question about second service massive reads affect on first service.
I understand that updates from second service will slow down every process because of mongoDB write lock but reads are little mysterious for me.
Ivan
Upvotes: 0
Views: 49
Reputation: 3696
There would be no direct impacts of the reads upon each other. As you mentioned, MongoDB uses a one writer many reader model, so as long as your workload is read only they should not directly impact each other.
That said, if the queries require more data than can be contained in RAM they will compete for access to the available RAM. This competition will require accessing data that is not in RAM from disk, which can also lead to one set of queries impacting each other as they must both read from disk.
Upvotes: 1