Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3542

Optimize equalTopologies to reduce or eliminate allocations

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Go Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      The existing equalTopologies implementation builds two temporary maps on every invocation to check that two description.Topology instances contain the same set of servers. In a busy topology monitor this could translate into millions of small heap allocations. The profile on the associate PR noted ~1GB per 2 hours.

      Definition of done

      Either replace the comparison with an O(n^2) solution that does not allocate the temporary maps or consider using maps to pointers of the servers.

      Pitfalls

      Creating a map to pointers of the servers could be risky, for example what happens when we re-allocate the underlying slice?

            Assignee:
            preston.vasquez@mongodb.com Preston Vasquez
            Reporter:
            preston.vasquez@mongodb.com Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: