MongoDB – overloading PRIMARY with multiple replica set

mongodb

MongoDB replica sets read data from Primary oplogs. So, Does it mean that having too many replica sets will put load on Primary node as all replica nodes will have to read data from Primary oplog? We have 7 nodes cluster though the load is not heavy and hence checking if we need to downsize it to 5 or so ..

Thanks

Best Answer

MongoDB replica sets read data from Primary oplogs.

Secondaries in replica sets sync from another member of the replica set with a newer oplog, but that does not necessarily have to be the current primary.

MongoDB supports chained replication, where a secondary member can replicate from another secondary member instead of the primary. This feature is enabled by default, and is particularly useful to minimise network traffic for deployments spanning multiple data centres. Unless chained replication is specifically disallowed, secondaries will periodically evaluate the member they are syncing from and may choose a lower latency secondary (with a more current oplog) to sync from.

You can check which member a secondary is syncing from via rs.status(). There should be a syncSourceHost field (MongoDB 4.0+) or a syncingTo field (deprecated name for the same field in older versions of MongoDB).

We have 7 nodes cluster though the load is not heavy and hence checking if we need to downsize it to 5 or so ..

If you aren't seeing any performance issues with your current deployment and workload, there should be no need to proactively downgrade unless you feel the extra replica set members are no longer needed for your use case.