Deploying containers sharding on the same server


I am working with docker and mongodb containters (in a replica set configuration), so I have 3 nodes, each with a mongodb container (1 Primary, 2 secondaries).
Each sefver is quite powerfull (20 CPU’s, 100 GB RAM ).

We expect ourdata to grow quite large, and for that I should use sharding as far as I understand.

My question is:
Does it make any sense to configure sharding using containers on the same server?
Any advantages for deploying sharding like this…?


I do not have numbers or documentation to support my opinion but I would say that it does not make a lot of sense. The purpose of sharding is to distribute the load so that more work can be done in parallel and when more powerful hardware is not an option. If you run many shards on the same physical server within container, VM or simply another process you will end up having many processes fighting for the same resources while adding some latency for the routing of the queries. In my opinion if you cannot shard on different physical hardware you might end up with a more complicated configuration which ‘might’ be less performant. Do not forget that mongos and config servers will chew up on these resources.

Yes. For testing purpose.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.