we want to connect multiple mongodb with load balancer

297 views
Skip to first unread message

Kipl Dinesh

unread,
May 11, 2015, 6:34:23 PM5/11/15
to mongod...@googlegroups.com
Hello,
we want to connect multiple mongo db with load balancer. how it will work?
Thanks

Stephen Dillon

unread,
May 12, 2015, 7:15:39 AM5/12/15
to mongod...@googlegroups.com
Understanding your topology would help folks answer this.

Do you mean multiple instances of conceptually the same DB (i.e. a sharded cluster) or different databases with different schema and conceptually unrelated data?
If you have a sharded cluster, you essentially already have load balancing via the mongoS routers. One of the keys the Mongo folks emphasized to me in the Advanced Ops course was to never place a load balancer in front of a MongoS. In my tests, it significantly degraded performance doing so.

Paulo

unread,
May 12, 2015, 7:34:12 AM5/12/15
to mongod...@googlegroups.com
What do you mean with  "never place a load balancer in front of a MongoS" ?

Stephen Dillon

unread,
May 12, 2015, 7:45:30 AM5/12/15
to mongod...@googlegroups.com
i.e. between the actual app and the Mongo router.

The MongoDB instructors said to not use a load balancer technology that would control how data is sent to the 3 MongoDB routers. The reasoning was that a LB would result in less efficient use of the Mongo routers. To paraphrase them, the combination of the app and a Mongo router is acting as the LB for Mongo (in a typical 3 MongoS configuration)..

I did not want to believe that at face value so I further explored different methods of LB such as round-robin, performance, and failover etc. Non of my results, purely from a MongoDB operations per second viewpoint, were good when compared to only using an App to MongoS connection. Inserts per Second were an important KPI for my use case so we opted to not use a LB between the client App and MongoDB routers.

 

On Tue, May 12, 2015 at 7:34 AM, Paulo <pauloan...@gmail.com> wrote:
What do you mean with  "never place a load balancer in front of a MongoS" ?

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/YkFewghvfqE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/4ad8b58f-21aa-4ed6-a3d8-4388bb2a6ffe%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Regards,
Stephen

s.molinari

unread,
May 12, 2015, 11:04:12 AM5/12/15
to mongod...@googlegroups.com
Interesting, because I thought the same thing, but the docs say otherwise.


You may also deploy a group of mongos instances and use a proxy/load balancer between the application and the mongos. In these deployments, you must configure the load balancer for client affinity so that every connection from a single client reaches the same mongos.

Scott 

Stephen Dillon

unread,
May 12, 2015, 11:16:57 AM5/12/15
to mongod...@googlegroups.com
If degraded performance is not an issue, then you have nothing to lose I guess. I am sure that from other perspectives LB could make sense to someone.

This is why when someone comes to me with a performance problem I look at it from the perspective of the mongo instances outward. I only claim performance KPIs from the Mongo shell and allow the developers and app architects to attempt to match it. I can accurately claim that insert operations per second were negatively effected by approximately 30% when implementing LB.

The trainer who was emphatic about this was Matias Cascallares and the other trainer backed him up on it when he heard I discussing it during a break. Maybe something has changed since then. This was as of an Advanced Ops course last year at Mongo World. See https://university.mongodb.com/private_training .

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/YkFewghvfqE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.

For more options, visit https://groups.google.com/d/optout.



--

Regards,
Stephen

Reply all
Reply to author
Forward
0 new messages