I have multiple collections with 100000 documents in each collection and 10000 columns in each document. There is a python script which executes aggregate queries in a multi-threaded fashion. Each thread invokes an aggregate on a separate collection.
When the script is executed, the amount of time it takes to complete the aggregation is proportional to the number of threads. i.e. the latency linearly increases with number of queries concurrently executed.
If aggregation on single collection takes ‘x’ amount of time, then multi-threaded aggregations on ‘n’ collections takes almost ‘n*x’ amount of time.
My expectation was that the multi-threaded queries would take roughly the same amount of time as the single-threaded one. Now it’s apparent that multiple queries are not executed concurrently in mongodb. Is this the known limitation? Is there any configuration parameter in mongodb to control concurrency?
I’ve asked the same question on stackoverflow as well: https://stackoverflow.com/questions/62007353/mongodb-concurrent-queries-on-different-collections-are-slow