Skip to content

Commit 5866c4b

Browse files
(DOCSP-35335): Add maxConnecting setting for connection pools (#5917) (#6016)
* (DOCSP-35335): Add maxConnecting setting for connection pools * formatting fix * add definition * wording * add context to changing maxConnecting * wording * note relationship with maxPoolSize * edit * address tech review comments * review edit * add definition for connection storm * wording * typo * more edits * edit * wording
1 parent 99d4a37 commit 5866c4b

File tree

4 files changed

+85
-49
lines changed

4 files changed

+85
-49
lines changed

source/administration/connection-pool-overview.txt

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
Connection Pool Overview
55
========================
66

7+
.. facet::
8+
:name: genre
9+
:values: reference
10+
711
.. default-domain:: mongodb
812

913
.. contents:: On this page
@@ -79,13 +83,13 @@ to be established.
7983
Connection Pool Configuration Settings
8084
--------------------------------------
8185

82-
To configure the connection pool, set the options:
86+
You can specify connection pool settings in these locations:
8387

84-
- through the :ref:`MongoDB URI <mongodb-uri>`,
88+
- The :ref:`MongoDB URI <mongodb-uri>`
8589

86-
- programmatically when building the ``MongoClient`` instance, or
90+
- Your application's ``MongoClient`` instance
8791

88-
- in your application framework's configuration files.
92+
- Your application framework's configuration files
8993

9094
Settings
9195
~~~~~~~~
@@ -97,6 +101,33 @@ Settings
97101
* - Setting
98102
- Description
99103

104+
* - :urioption:`connectTimeoutMS`
105+
106+
- Most drivers default to never time out. Some versions of the
107+
Java drivers (for example, version 3.7) default to ``10``.
108+
109+
*Default:* ``0`` for most drivers. See your :driver:`driver </>`
110+
documentation.
111+
112+
* - :urioption:`maxConnecting`
113+
114+
- Maximum number of connections a pool may be establishing
115+
concurrently.
116+
117+
``maxConnecting`` is supported for all drivers **except** the
118+
:driver:`Rust Driver </rust/current/>`.
119+
120+
.. include:: /includes/connection-pool/max-connecting-use-case.rst
121+
122+
*Default:* ``2``
123+
124+
* - :urioption:`maxIdleTimeMS`
125+
126+
- The maximum number of milliseconds that a connection can
127+
remain idle in the pool before being removed and closed.
128+
129+
*Default:* See your :driver:`driver </>` documentation.
130+
100131
* - :urioption:`maxPoolSize`
101132

102133
- .. _maxpoolsize-cp-setting:
@@ -118,51 +149,31 @@ Settings
118149

119150
*Default*: ``0``
120151

121-
* - :urioption:`connectTimeoutMS`
122-
123-
- Most drivers default to never time out. Some versions of the
124-
Java drivers (for example, version 3.7) default to ``10``.
125-
126-
*Default:* ``0`` for most drivers. See your :driver:`driver </>`
127-
documentation.
152+
* - :parameter:`ShardingTaskExecutorPoolMaxSize`
128153

129-
* - :urioption:`socketTimeoutMS`
154+
- Maximum number of outbound connections each TaskExecutor
155+
connection pool can open to any given :binary:`~bin.mongod`
156+
instance.
130157

131-
- Number of milliseconds to wait before timeout on a TCP
132-
connection.
133-
134-
Do *not* use :urioption:`socketTimeoutMS` as a mechanism for
135-
preventing long-running server operations.
158+
*Default*: 2\ :sup:`64` - 1
136159

137-
Setting low socket timeouts may result in operations that error
138-
before the server responds.
139-
140-
*Default*: ``0``, which means no timeout. See your
141-
:driver:`driver </>` documentation.
160+
Parameter only applies to sharded deployments.
142161

143-
* - :urioption:`maxIdleTimeMS`
144-
145-
- The maximum number of milliseconds that a connection can
146-
remain idle in the pool before being removed and closed.
162+
* - :parameter:`ShardingTaskExecutorPoolMaxSizeForConfigServers`
147163

148-
*Default:* See your :driver:`driver </>` documentation.
164+
- .. include:: /includes/ShardingTaskExecutorPoolMaxSizeForConfigServers-parameter.rst
149165

150-
* - :urioption:`waitQueueTimeoutMS`
166+
*Default*: ``-1``
151167

152-
- Maximum wait time in milliseconds that a can thread wait for
153-
a connection to become available. A value of ``0`` means there
154-
is no limit.
168+
.. versionadded:: 6.0
155169

156-
*Default*: ``0``. See your :driver:`driver </>` documentation.
157-
158170
* - :parameter:`ShardingTaskExecutorPoolMinSize`
159171

160172
- Minimum number of outbound connections each TaskExecutor
161173
connection pool can open to any given :binary:`~bin.mongod`
162174
instance.
163175

164-
*Default*: ``1``. See
165-
:parameter:`ShardingTaskExecutorPoolMinSize`.
176+
*Default*: ``1``
166177

167178
Parameter only applies to sharded deployments.
168179

@@ -174,24 +185,26 @@ Settings
174185

175186
.. versionadded:: 6.0
176187

177-
* - :parameter:`ShardingTaskExecutorPoolMaxSize`
178-
179-
- Maximum number of outbound connections each TaskExecutor
180-
connection pool can open to any given :binary:`~bin.mongod`
181-
instance.
182-
183-
*Default*: 2\ :sup:`64` - 1. See
184-
:parameter:`ShardingTaskExecutorPoolMaxSize`.
188+
* - :urioption:`socketTimeoutMS`
185189

186-
Parameter only applies to sharded deployments.
190+
- Number of milliseconds to wait before timeout on a TCP
191+
connection.
192+
193+
Do *not* use :urioption:`socketTimeoutMS` as a mechanism for
194+
preventing long-running server operations.
187195

188-
* - :parameter:`ShardingTaskExecutorPoolMaxSizeForConfigServers`
196+
Setting low socket timeouts may result in operations that error
197+
before the server responds.
198+
199+
*Default*: ``0``, which means no timeout.
189200

190-
- .. include:: /includes/ShardingTaskExecutorPoolMaxSizeForConfigServers-parameter.rst
201+
* - :urioption:`waitQueueTimeoutMS`
191202

192-
*Default*: ``-1``
203+
- Maximum wait time in milliseconds that a can thread wait for
204+
a connection to become available. A value of ``0`` means there
205+
is no limit.
193206

194-
.. versionadded:: 6.0
207+
*Default*: ``0``
195208

196209
.. toctree::
197210
:titlesonly:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Raising the value of ``maxConnecting`` allows the client to establish
2+
connection to the server faster, but increases the chance of
3+
:term:`connection storms <connection storm>`. If the value of
4+
``maxConnecting`` is too low, your connection pool may experience heavy
5+
throttling and increased tail latency for clients checking out
6+
connections.

source/reference/connection-string.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,16 @@ connecting to the MongoDB deployment.
697697
drivers. For information on your driver, see the
698698
:driver:`Drivers </>` documentation.
699699

700+
* - .. urioption:: maxConnecting
701+
702+
- Maximum number of connections a pool may be establishing
703+
concurrently. The default value is ``2``.
704+
705+
``maxConnecting`` is supported for all drivers **except** the
706+
:driver:`Rust Driver </rust/current/>`.
707+
708+
.. include:: /includes/connection-pool/max-connecting-use-case.rst
709+
700710
* - .. urioption:: maxIdleTimeMS
701711

702712
- The maximum number of milliseconds that a connection can remain
@@ -1481,4 +1491,3 @@ The following connects to a sharded cluster with three :binary:`~bin.mongos` ins
14811491
``D1fficultP%40ssw0rd``:
14821492

14831493
.. include:: /includes/connection-examples-by-language-sharded.rst
1484-

source/reference/glossary.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ Glossary
252252
retrying one of the operations in any :term:`write
253253
conflict`.
254254

255+
connection storm
256+
A scenario where a driver attempts to open more connections to a
257+
deployment than that deployment can handle. When requests for new
258+
connections fail, the driver requests to establish even more
259+
connections in response to the deployment slowing down or failing
260+
to open new connections. These continuous requests can overload
261+
the deployment and lead to outages.
262+
255263
config database
256264
An internal database with metadata for a :term:`sharded cluster`.
257265
Typically, you don't modify the ``config`` database. For more

0 commit comments

Comments
 (0)