Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-961

Support serverSelectionTryOnce in multi-threaded drivers

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Blocked
    • Priority: Major - P3
    • Resolution: Unresolved
    • Component/s: SDAM
    • Labels:
      None

      Description

      The current spec indicates that single-threaded drivers must implement serverselectiontryonce but multi-threaded drivers must not.

      There's benefit in implementing serverselectiontryonce in multi-threaded drivers as well so they can fail fast in case the server isn't running.
      Using a low serverSelectionTimeout isn't sufficient as we need to distinguish between a case in which the server is actually down (where the dialer returns connection refused) or the connection is closed and other cases in which the server is simply slow to respond.

      Current workarounds are a bit cumbersome - for example when working with the Go Driver we were able to workaround this using the following approaches:
      1. Connect to the host:port with a simple TCP dialer before we attempt to Connect/Ping using the driver
      2. Pass on a custom dialer with a cancel function and invoke the cancel function if we hit "connection refused"

      To highlight the benefit of this (on top of cleaner code) - this is expected to introduce a significant performance boost to the MongoDB agent, especially in large clusters deployments

        Attachments

          Activity

            People

            Assignee:
            rachelle.palmer Rachelle Palmer
            Reporter:
            tomer.yakir Tomer Yakir
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated: