4
4
Connection Pool Overview
5
5
========================
6
6
7
+ .. facet::
8
+ :name: genre
9
+ :values: reference
10
+
7
11
.. default-domain:: mongodb
8
12
9
13
.. contents:: On this page
@@ -79,13 +83,13 @@ to be established.
79
83
Connection Pool Configuration Settings
80
84
--------------------------------------
81
85
82
- To configure the connection pool, set the options :
86
+ You can specify connection pool settings in these locations :
83
87
84
- - through the :ref:`MongoDB URI <mongodb-uri>`,
88
+ - The :ref:`MongoDB URI <mongodb-uri>`
85
89
86
- - programmatically when building the ``MongoClient`` instance, or
90
+ - Your application's ``MongoClient`` instance
87
91
88
- - in your application framework's configuration files.
92
+ - Your application framework's configuration files
89
93
90
94
Settings
91
95
~~~~~~~~
@@ -97,6 +101,33 @@ Settings
97
101
* - Setting
98
102
- Description
99
103
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
+
100
131
* - :urioption:`maxPoolSize`
101
132
102
133
- .. _maxpoolsize-cp-setting:
@@ -118,51 +149,31 @@ Settings
118
149
119
150
*Default*: ``0``
120
151
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`
128
153
129
- * - :urioption:`socketTimeoutMS`
154
+ - Maximum number of outbound connections each TaskExecutor
155
+ connection pool can open to any given :binary:`~bin.mongod`
156
+ instance.
130
157
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
136
159
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.
142
161
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`
147
163
148
- *Default:* See your :driver:`driver </>` documentation.
164
+ - .. include:: /includes/ShardingTaskExecutorPoolMaxSizeForConfigServers-parameter.rst
149
165
150
- * - :urioption:`waitQueueTimeoutMS `
166
+ *Default*: ``-1` `
151
167
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
155
169
156
- *Default*: ``0``. See your :driver:`driver </>` documentation.
157
-
158
170
* - :parameter:`ShardingTaskExecutorPoolMinSize`
159
171
160
172
- Minimum number of outbound connections each TaskExecutor
161
173
connection pool can open to any given :binary:`~bin.mongod`
162
174
instance.
163
175
164
- *Default*: ``1``. See
165
- :parameter:`ShardingTaskExecutorPoolMinSize`.
176
+ *Default*: ``1``
166
177
167
178
Parameter only applies to sharded deployments.
168
179
@@ -174,24 +185,26 @@ Settings
174
185
175
186
.. versionadded:: 6.0
176
187
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`
185
189
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.
187
195
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.
189
200
190
- - .. include:: /includes/ShardingTaskExecutorPoolMaxSizeForConfigServers-parameter.rst
201
+ * - :urioption:`waitQueueTimeoutMS`
191
202
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.
193
206
194
- .. versionadded:: 6.0
207
+ *Default*: ``0``
195
208
196
209
.. toctree::
197
210
:titlesonly:
0 commit comments