Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB load balancer for the Replica set

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

like image 605
Geek Avatar asked May 05 '17 11:05

Geek


1 Answers

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/

like image 119
Amit Yadav Avatar answered Oct 05 '22 23:10

Amit Yadav