[CSHARP-3754] Provide options to limit number of mongos servers used in connecting to sharded clusters Created: 21/Jul/21  Updated: 28/Oct/23  Resolved: 19/Nov/21

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.14.0

Type: Spec Change Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: James Kovacs
Resolution: Fixed Votes: 0
Labels: size-medium
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Issue split
Related
is related to CSHARP-3926 Do not expect both valid:false and wa... Closed
Quarter: FY22Q3
Upstream Changes Summary:

DRIVERS-1519:
Introduces an srvMaxHosts MongoClient option, which is used to limit the number of seeds derived from SRV records (and only supported with the mongodb+srv:// scheme). Also limits the number of mongos seeds that may be picked up during SRV polling.

Introduces the following test chnages:

  • New spec tests for Initial DNS Seedlist Discovery and URI options specs.
  • New numSeeds and numHosts fields to the Initial DNS Seedlist Discovery spec test format.
  • New SRV Polling prose tests

Drivers should sync with mongodb/specifications@b508f6d. If possible, drivers may consider implementing DRIVERS-1959 alongside this ticket and sync to mongodb/specifications@84bdb3f, which fixes an issue with the original URI options tests for DRIVERS-1519.

Backwards Compatibility: Fully Compatible

 Description   
Epic Summary

Summary

Supply a mechanism to limit the number of mongos servers used in connecting to sharded clusters.

Motivation

Connections using cluster SRV records having many mongos addresses can result in very large numbers of connections to mongos servers. This can lead to a variety of severe performance issues resulting from rapid buildup of connections, both to mongos servers, as well as from mongos servers to shard mongod servers. Limiting the mongos servers used in connecting to clusters has been found to help in reducing  high connection counts and associated negative performance impacts. 

Who is the affected end user?

Customers on Atlas using sharded clusters. Per each cluster, Atlas creates 3 mongos. For example, a 25 shard cluster will have 75 mongos instances. Since we default to using an SRV connection string, the MongoDB drivers will effectively have to manage connections to all 75 mongos instances. In one customer's case, with a large number of application servers, this results in between 10,000 and 13,000 connections to each mongos.

How does this affect the end user?

A large number of connections to each mongos leads to excessive memory usage by each mongos and on application servers.

Is this issue urgent?

No, customer has PS designing a workaround

Is this ticket only for tests?

No

Is this ticket required by a downstream team?

No

Cast of Characters

Engineering Lead:
Document Author:
POCers:
Product Owner: Rachelle Palmer
Program Manager:
Stakeholders:



 Comments   
Comment by Githook User [ 19/Nov/21 ]

Author:

{'name': 'James Kovacs', 'email': 'jkovacs@post.harvard.edu', 'username': 'JamesKovacs'}

Message: CSHARP-3754: Implemented srvMaxHosts for both initial seedlist and SRV polling. (#666)
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/eecbb0151e344ba85c714c18da41f3fec963019b

Generated at Wed Feb 07 21:46:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.