MongoDB Oplog Replication Lag

Hi Team,

On the application side they have time out of 20ms and using read preference as nearest to achieve the best result. With this configuration, getting frequent “Data not found” error on the application.

I have 2 Replica Set in a shard with 3 nodes in each. 2 nodes on A Data Center and 1 node in B Data Center. The time taken to replicate the data within the Data Center is 1sec and 2 sec to other Data Center.

Is there a way or parameter settings to minimize the replication lag in the replica set?