Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-5190

Implement correct TCP keepalive defaults

    • 2
    • Not Needed
    • Needed
    • Hide

      1. What would you like to communicate to the user about this feature?

      That the driver no longer allows setting keepAlive and keepAliveInitialDelay as options, but sets them to true and 30000 respectively.

      2. Would you like the user to see examples of the syntax and/or executable code and its output?

      No examples needed, but maybe a link to show how to configure options at a system level as Node does not allow configuration of any other options. A link to https://www.mongodb.com/docs/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments could help.

      3. Which versions of the driver/connector does this apply to?

      6.0.0

      Show
      1. What would you like to communicate to the user about this feature? That the driver no longer allows setting keepAlive and keepAliveInitialDelay as options, but sets them to true and 30000 respectively. 2. Would you like the user to see examples of the syntax and/or executable code and its output? No examples needed, but maybe a link to show how to configure options at a system level as Node does not allow configuration of any other options. A link to https://www.mongodb.com/docs/manual/faq/diagnostics/#does-tcp-keepalive-time-affect-mongodb-deployments could help. 3. Which versions of the driver/connector does this apply to? 6.0.0

      We should confirm that our TCP keep alive options are compliant with this specification, the default value for the seconds does match what we use in the driver.

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

      AC

      • Update logic to setKeepAlive to 300000 which will under the hood set TCP_KEEPIDLE to 300000.
      • Remove the deprecated keep alive options

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Warren James
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: