Question

As far as I know, replication in MongoDB is a way to keep same data set in different servers on mongods. I read the MongoDB documentation but I didn't find anything related to performance changes.

There's always a question for me that can replication help MongoDB in write/read operation performance or not?

Was it helpful?

Solution

The performance shouldn't be affected by this. The primary does not replica down but rather the secondaries and other members "pick" form the primaries oplog, which is basically a journal of operations.

I suppose there is a performance hit in the storage of the oplog, you do need some extra disk space.

There's always a question for me that can replication help MongoDB in write/read operation performance or not?

Not write no, you can only ever write to the primary and since reads are concurrent and you have a writer greedy lock you don't have write performance gains.

As for reads; well the vote is out on that. Since the members of the set get just as many OPs as the primary and in turn just as much weight many say that actually it doesn't help at all, however, they do concede that in certain cases (analytics reporting) it does help.

Of course the reads will always return stale data, i.e. data that might have changed/deleted.

Really whether replica reads will benefit you or not is up to your scenario and we do not know enough to tell you yes or no.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top