[CDRIVER-2176] Enable and configure TCP Keepalive by default Created: 06/Jun/17  Updated: 28/Oct/23  Resolved: 17/Aug/17

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.8.0

Type: Improvement Priority: Major - P3
Reporter: Rathi Gnanasekaran Assignee: Hannes Magnusson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-1363 Have TCP keepalive default to true Closed
is depended on by DRIVERS-383 Enable and configure TCP Keepalive by... Closed
is depended on by PHPC-969 Have TCP keepalive default to true Closed

 Description   
  1. A driver MUST enable TCP keepalive by default. This matches the behavior of the MongoDB server.
  2. A driver MUST deprecate TCP keepalive-related options in the connection string (and any other way that it is configured), as there is no demonstrated benefit to allowing it to be disabled. This also matches the behavior of the server.
  3. A driver SHOULD set tcp_keepalive_time to 300 seconds unless it determines that the system default is already less than that. If the driver is unable to determine the system default at all it should not attempt to change it. This matches the behavior of the server as well.
  4. A driver SHOULD set tcp_keepalive_intvl to 10 seconds unless it determines that the system default is already less than that. If the driver is unable to determine the system default at all it should not attempt to change it. This is not the current behavior of the server, but if accepted here it will be recommended. The reasoning is that with the default of 75 seconds for this value and a default of 9 probes, the actual time to failure is 300 + (75 * 9) = 975 sec = 16.25 minutes. With a 10 second interval between probes it becomes a more reasonable 6.5 minutes.
  5. A driver SHOULD set tcp_keepalive_cnt to 9 probes unless it determines that the system default is already less than that. If the driver is unable to determine the system default at all it should not attempt to change it.
  6. A driver MUST document how keepalive-related options are configured. Drivers that can set tcp_keepalive_time and tcp_keepalive_intvl to the values mandated above MUST document that they do so. Drivers that can not MUST document that they do not and link to appropriate MongoDB Diagnostics FAQ keepalive section for instructions on setting these values at the system level.

As part of this change, drivers should include in their documentation a link to the MongoDB Diagnostics FAQ keepalive section



 Comments   
Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'bjori', 'name': u'Hannes Magnusson', 'email': u'bjori@php.net'}

Message:Merge branch 'doc-keepalive'

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'bjori', 'name': u'Hannes Magnusson', 'email': u'bjori@php.net'}

Message:CDRIVER-2176 Document keepalive options
Branch:master
https://github.com/mongodb/mongo-c-driver/commit/bccc0245795f9da26770a44f6a88fe2e8d0ceb31

Comment by Ramon Fernandez Marina [ 12/Sep/17 ]

Author:

{'username': u'ajdavis', 'name': u'A. Jesse Jiryu Davis', 'email': u'jesse@mongodb.com'}

Message:Merge remote-tracking branch 'upstream/master'

Comment by Githook User [ 17/Aug/17 ]

Author:

{'username': 'bjori', 'email': 'bjori@php.net', 'name': 'Hannes Magnusson'}

Message: CDRIVER-2176 Enable and configure TCP Keepalive on macOS
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/6f538bc1a23f7282b2c313af53be0dddd59c89b4

Comment by Hannes Magnusson [ 15/Aug/17 ]

This is insufficient on macOS, which calls TCP_KEEPIDLE TCP_KEEPALIVE

Comment by Hannes Magnusson [ 11/Aug/17 ]

https://github.com/mongodb/mongo-c-driver/commit/f929c7cea31ebe136a9127cc19a65949c0bdd2d9

Comment by Hannes Magnusson [ 10/Aug/17 ]

need to add docs

Comment by Githook User [ 10/Aug/17 ]

Author:

{'username': 'bjori', 'email': 'bjori@php.net', 'name': 'Hannes Magnusson'}

Message: CDRIVER-2176 Enable and configure TCP Keepalive by default
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/fe3fd392dbc684fc2b89099ae3e53679e7e296b1

Generated at Wed Feb 07 21:14:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.