-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
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?