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

Hybrid SRV connection string format for faster initial discovery

    • Needed

      Summary

      When comparing mongodb+srv:// and mongodb:// URIs, srv is great because it allows Atlas to change/add/remove the underlying hosts without code or configuration changes. SRV has some downsides though, 1) it adds latency overhead for the initial connection and the time to first command (TTFC) and 2) it SRV+TXT lookup is not as stable in some environments leading to lookup errors.

      We should consider adding a hybrid format with the benefits of both, for example:

      "mongodb://cluster1.mongodb.net:27017,[more hosts...]/?srvHost=cluster1-srv.mongodb.net"
      

      The driver would optimistically connect to the hosts in the URI and perform the SRV+TXT lookup in parallel to discover if the hosts have changed. Applications could use this format to reduce the TTFC. It would also allow the driver to connect even if SRV/TXT lookup fails assuming the hosts in the URI have not changed.

      Motivation

      Who is the affected end user?

      Who are the stakeholders?

      How does this affect the end user?

      Are they blocked? Are they annoyed? Are they confused?

      How likely is it that this problem or use case will occur?

      Main path? Edge case?

      If the problem does occur, what are the consequences and how severe are they?

      Minor annoyance at a log message? Performance concern? Outage/unavailability? Failover can't complete?

      Is this issue urgent?

      Does this ticket have a required timeline? What is it?

      Is this ticket required by a downstream team?

      Needed by e.g. Atlas, Shell, Compass?

      Is this ticket only for tests?

      Does this ticket have any functional impact, or is it just test improvements?

            Assignee:
            Unassigned Unassigned
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: