|
This couldn't be implemented using current releases of MongoDB, at least not completely. There are at least two problems that would have to be resolved in the server first:
- The replication lag information would have to be readily available to all authenticated users. Currently this information comes from the replSetGetStatus command, which requires the clusterManager permission to run.
- mongos would have to accept the acceptable replication lag as a $readPreference option, and apply it when choosing secondaries.
On top of this, drivers monitor connected servers on a fixed frequency (10 seconds), but replication lag tends to spike for short periods of time. That monitoring frequency might not be granular enough. This would not be a solution for trying to force read-your-writes consistency while reading from secondaries.
|