-
Type: Epic
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
-
Done
-
maxConnecting
Summary
Limit # of Concurrent Connection Attempts (maxConnecting)
When creating a new connection, ensure that only a certain # of connections are also being created against that server. If too many are being created at a given time, wait until this number decreases. This will greatly reduce the driver’s ability to overload a server in a simple and effective way. This was already implemented in mongos (SERVER-29237) with a default value of 2, and the server team has reported that they have not seen any indications of connection storms caused by mongos since then.
Intuitively, this mitigation seems like it may limit throughput. In practice, it has been observed in mongos that it may actually improve performance in certain scenarios, since connection establishment and handshaking are such expensive operations. Without this mitigation, when facing a burst of operations, the server will perform a high number of concurrent handshakes and then execute each operation on the resultant connections. With maxConnecting, the server performs only a few concurrent handshakes and can quickly perform many operations using the existing connections that were already handshaked.
Motivation
The propensity for drivers to inundate a server with new connections during failover events has been identified as a particular pain point for our customers.