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

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

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

Issue Links:
Depends
is depended on by PHPC-1908 Allow limiting mongos servers with sr... Closed
Issue split
Related
related to CDRIVER-4230 Configure Evergreen to support sharde... Backlog
Quarter: FY22Q3, FY22Q4
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.


 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 [ 30/Nov/21 ]

Author:

{'name': 'Ezra Chung', 'email': '88335979+eramongodb@users.noreply.github.com', 'username': 'eramongodb'}

Message: CDRIVER-4097 Implement srvMaxHosts for initial DNS seedlist and SRV polling (#898)

  • Permit zero hosts when validating SRV loadBalanced URI before DNS query
  • Add URI parsing support for srvMaxHosts
  • Add documentation of MONGOC_URI_SRVMAXHOSTS to mongoc_uri_t.rst
  • Add URI Options spec tests for srvMaxHosts
  • Add const qualifier to _mongoc_host_list_length() parameters
  • Add bounded uniform distributed random integer generators
  • Fix infinite loop in dump_hosts()
  • Add support for limiting initial DNS seedlist per srvMaxHosts
  • Add srvMaxHosts spec tests for Initial DNS Seedlist Discovery
  • Add support for limiting SRV record polling hosts per srvMaxHosts
  • Add prose tests for SRV Polling
  • Refactor SRV Polling prose tests to handle single vs. pooled cases
    Branch: master
    https://github.com/mongodb/mongo-c-driver/commit/d67527c6b733e11e88e69240c57cc39471942054
Generated at Wed Feb 07 21:19:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.