@@ -238,32 +238,50 @@ to an operation that returns a ``Cursor``:
238
238
.. literalinclude:: /code-snippets/faq/maxTimeMS-example.js
239
239
:language: javascript
240
240
241
- What Does the "keepAlive" Setting Do?
242
- ---------------------------------------
241
+ .. _node-faq-keepalive:
243
242
244
- ``keepAlive`` is a ``connection-setting`` that sets the number of
245
- milliseconds to wait before initiating a :wikipedia:`TLS keepAlive
246
- <Keepalive#TCP_keepalive>` on a TCP Socket. The ``keepAlive`` option
247
- will keep a socket alive by sending periodic probes to MongoDB. However,
248
- this only works if the operating system supports ``SO_KEEPALIVE``\ .
243
+ What Does the keepAlive Option Do?
244
+ ----------------------------------
249
245
250
- This setting is deprecated in v5.3 of the {+driver-short+} and later.
246
+ The ``keepAlive`` connection option specifies whether to enable
247
+ :wikipedia:`Transmission Control Protocol (TCP) keepalives
248
+ <Keepalive#TCP_keepalive>` on a TCP socket. If you enable keepalives,
249
+ the driver checks whether the connection is active by sending periodic pings
250
+ to your MongoDB deployment. This functionality only works if your
251
+ operating system supports the ``SO_KEEPALIVE`` socket option.
252
+
253
+ The ``keepAliveInitialDelay`` option specifies the number of
254
+ milliseconds that the driver waits before initiating a keepalive.
255
+
256
+ The 5.3 driver version release deprecated these options. Starting in
257
+ version 6.0 of the driver, the ``keepAlive`` option is permanently set
258
+ to ``true``, and the ``keepAliveInitialDelay`` is set to 300000
259
+ milliseconds (300 seconds).
251
260
252
261
.. warning::
253
- If a firewall ignores or drops the ``keepAlive`` packets this may not work
262
+
263
+ If your firewall ignores or drops the keepalive messages, you might
264
+ not be able to identify dropped connections.
254
265
255
266
What Can I Do If I'm Experiencing Unexpected Network Behavior?
256
267
--------------------------------------------------------------
257
- Internal firewalls that exist between application servers and MongoDB
258
- are often misconfigured and are overly aggressive in their removal of
259
- socket connections.
260
268
261
- If you experience unexpected network behavior, here
262
- are some things to check:
269
+ You might experience unexpected network behavior if the firewall between
270
+ your application and MongoDB is misconfigured. These firewalls can be
271
+ overly aggressive in their removal of connections, which can lead to
272
+ unexpected errors.
273
+
274
+ Confirm that your firewall exhibits the following behavior:
263
275
264
- #. The firewall should send a ``FIN packet`` when closing a socket,
265
- allowing the driver to detect that the socket is closed.
266
- #. The firewall should allow ``keepAlive`` probes.
276
+ - The firewall sends a ``FIN`` packet when closing a connection,
277
+ informing the driver that the socket is closed.
278
+
279
+ - The firewall allows keepalive messages.
280
+
281
+ .. tip::
282
+
283
+ To learn more about keepalive messages, see the :ref:`What Does the
284
+ keepAlive Option Do? <node-faq-keepalive>` FAQ entry.
267
285
268
286
How Can I Prevent a Slow Operation From Delaying Other Operations?
269
287
------------------------------------------------------------------
0 commit comments