Reputation: 1344
In replica set cluster of MongoDB how can i ensure quick response for a concurent users when my primary is busy in serving another request?
Do i need to use load balancer, or the mongodb itself route the query to available Secondary?
Thanks
Upvotes: 12
Views: 17101
Reputation: 9208
You don't need to use a load balancer, or to route queries to secondary nodes; the primary node can handle concurrent queries by itself:
Upvotes: 21
Reputation: 1039
Normally writes are handled by master and reads should be send to secondaries by setting read preference. Although it might take some negligible time to get data propagated to secondaries, as secondaries use oplog copy for data replication.
You do not need any load balancer, Mongo is capable of doing these things. Read more about it here -
https://docs.mongodb.com/manual/replication/
Upvotes: 3