Skip to content

Commit eebc25c

Browse files
authored
DOCSP-31324: keepalive settings removed + defaults (#738)
* DOCSP-31324: keepalive settings removed + defaults * MW PR fixes 1
1 parent 2119386 commit eebc25c

File tree

3 files changed

+50
-19
lines changed

3 files changed

+50
-19
lines changed

source/faq.txt

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -238,32 +238,50 @@ to an operation that returns a ``Cursor``:
238238
.. literalinclude:: /code-snippets/faq/maxTimeMS-example.js
239239
:language: javascript
240240

241-
What Does the "keepAlive" Setting Do?
242-
---------------------------------------
241+
.. _node-faq-keepalive:
243242

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+
----------------------------------
249245

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).
251260

252261
.. 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.
254265

255266
What Can I Do If I'm Experiencing Unexpected Network Behavior?
256267
--------------------------------------------------------------
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.
260268

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:
263275

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.
267285

268286
How Can I Prevent a Slow Operation From Delaying Other Operations?
269287
------------------------------------------------------------------

source/upgrade.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ Version 6.x Breaking Changes
7070
``tlsCertificateKeyFile`` connection options when you call the
7171
``MongoClient.connect()`` method, not when you create the
7272
``MongoClient`` instance.
73+
- The driver removes the ``keepAlive`` and ``keepAliveInitialDelay`` connection
74+
options. The value of ``keepAlive`` is permanently set to ``true`` and the
75+
value of ``keepAliveInitialDelay`` is set to 300000 milliseconds (300
76+
seconds).
7377
- The ``Db.command()`` method accepts only options that are not related
7478
to a specific command. To learn more about these options, see the
7579
:ref:`Command Options <node-command-options>` section of the Run a

source/whats-new.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ The {+driver-short+} v6.0 release includes the following features:
8888
object or set the ``tls``-prefixed options in your
8989
``MongoClientOptions`` instance. To learn more, see :ref:`node-connect-tls`.
9090

91-
- Removes support for the ``addUser()`` helper command. Use the
91+
- Removal of support for the ``addUser()`` helper command. Use the
9292
:manual:`createUser </reference/command/createUser>` MongoDB Shell command instead.
9393

94-
- Removes support for the ``collStats`` operation. Use the
94+
- Removal of support for the ``collStats`` operation. Use the
9595
:manual:`$collStats </reference/operator/aggregation/collStats>` aggregation operator
9696
instead.
9797

@@ -110,6 +110,15 @@ The {+driver-short+} v6.0 release includes the following features:
110110
the ``MongoClient.connect()`` method, not when you create a
111111
``MongoClient`` instance.
112112

113+
- Removal of the ``keepAlive`` and ``keepAliveInitialDelay`` connection
114+
options. The value of ``keepAlive`` is permanently set to ``true`` and the
115+
value of ``keepAliveInitialDelay`` is set to 300000 milliseconds (300
116+
seconds).
117+
118+
To learn how to set keepalive settings at a system level,
119+
see the :manual:`Does TCP keepalive time affect MongoDB Deployments? </faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments->`
120+
FAQ entry in the Server manual.
121+
113122
- Removes the following options for the ``Db.command()`` method:
114123

115124
- ``willRetryWrite``

0 commit comments

Comments
 (0)