Mongos Impact on Performance Of a Sharded Cluster


I am wondering if in a Sharded scenario like the one showed in the lectures, apart from the latency issue, if the mongos was to run on a dedicated machine, would it become a bottleneck and therefore the recommendation of running it on the application server?

Nothing stops you for running more than one instance of mongos. I can see where you have a couple of load balanced web servers each having their own mongos local to the web server or local to the mongod instances or even completely apart.

1 Like

My 2 cents!

Considering it’s a sharded cluster, each cluster will most likely be running on dedicated machines and perhaps each node of each replica set will also be running on dedicated machines… replication, high availability etc.

In such a scenario, your mongos is most likely going to run on a dedicated machine (perhaps co-located with the config server). And when you start routing queries to multiple shards (i.e. multiple machines as per setup) via routed or scattered gathered queries, it wouldn’t matter too much which machine it’s on because it needs to hit more than one machine. Main thing is to keep them close enough to reduce latency, and separate enough for high availability.

I only have one computer and I would like to practice with simulations of
clusters, nodes, shards , indexes etc.
Do you recommend me to use the native shell or Atlas?

I would recommend using native shell :slight_smile: In my experience, atlas automatically spins up a replica cluster, I used native shell to learn about mongodb, like shutting down any one node, see how elections went, etc

Having said that, everyone has their own preference, go on, do experiments, read the documentation and let us know if we can be of any help.