Details
-
Task
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
None
-
Fully Compatible
-
v3.4, v3.2
-
Query 2016-12-12
Description
Starting with MongoDB 3.2.0, aggregations which require a merging shard randomly select a merger amongst the shards participating in the query. This behavior was introduced under SERVER-18925 in order to help evenly distribute query load. In many situations this behavior is helpful, but it can have drawbacks. For example, when additional shards take on a merging role, more intra-cluster connections are required, which in turn requires additional resources. Therefore, we should introduce a setParameter on mongos called internalQueryAlwaysMergeOnPrimaryShard which can be used to disable random merger selection. The parameter's value is false by default. When configured to true, all aggregations which require a merging shard will merge on the primary shard. Pipelines which do not split into a shards part and merger part are not affected.
The parameter can be set on the command line when starting mongos or via a config file. To set it using the shell, connect to mongos and run the following:
db.adminCommand({setParameter: 1, internalQueryAlwaysMergeOnPrimaryShard: true});
|
Note that this parameter is for mongos only; attempting to set it against a mongod will result in an error:
> db.adminCommand({setParameter: 1, internalQueryAlwaysMergeOnPrimaryShard: true});
|
{
|
"ok" : 0,
|
"errmsg" : "attempted to set unrecognized parameter [internalQueryAlwaysMergeOnPrimaryShard], use help:true to see options "
|
}
|
Attachments
Issue Links
- is related to
-
SERVER-24815 Merging aggregation pipeline strategy should be configurable
-
- Backlog
-
-
SERVER-18925 Merging part of aggregation pipeline should be performed on a random shard to distribute the load
-
- Closed
-