cherry
cherry

Reputation: 137

Mongodb queires are slow as write and read goes to primary

I have 1 primary and 2 replicas created. Issue is I always need realtime data and the data needs to be upto date to the client. So, in order to achieve this by default the reads goes to primary. This is slowing the performance as all the reads and writes are going only to primary. Could anyone please let me know is there any other way I can improve the performance by balancing the load or some other way?

Upvotes: 0

Views: 397

Answers (1)

anhlc
anhlc

Reputation: 14449

Replica set is used to deal with failovers and only in case you don't need real time data, the secondary can serve the read operations.

In your case, to improve the performance, you need to set up sharded clusters instead. See In Mongo what is the difference between sharding and replication?

Upvotes: 1

Related Questions