-
Type: Improvement
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: SDAM
-
None
-
(copied to CRM)
The mutex on mongoc_topology_t is locked and unlocked at a rather coarse level.
- when reading or writing to the topology description
- it remains locked for the duration of SRV polling
- it is locked when accessing shared state of the mongoc_topology_scanner_t (e.g. the cached cluster time)
- it is locked when setting up a mongoc_topology_scanner_node_t. Which means it remains locked during blocking DNS lookup.
A potentially big problem with this is that application threads need to lock the topology mutex during server selection when reading the topology description.
CDRIVER-3535 may reduce the situations where the topology lock is held. But a read-write lock still seems like a sensible improvement for the topology description. If a client is performing many operations, the topology description will be read much more than it is written too.
Before making this change, let's validate with some form of benchmarking that this is really a point of contention that could be improved by a read-write lock.