1.

What is the need for Replication in MongoDB and what all kinds of replica members does it support?

Answer»

In replication we have multiple copies of the same data in sync with each other. It is mainly useful for High availability purpose. While in sharding we divide our entire dataset in small chunks and distribute among several servers. Sharding is used where we have some sort of bottleneck in terms of HARDWARE or for getting the benefits of query parallelism. If our dataset is very small sharding would not provide many advantages but as the data grows we should move to sharding.

Below are a few of the situations where sharding is recommended over replication.

  • If our MongoDB instance cannot keep up with the APPLICATION's write load. We have exhausted RAM and CPU options for the server.
  • Out data set is too big to fit in a single MongoDB instance. We have reached the disk limits for the server.
  • To improve read performance for the application. By USING targeted queries in the SHARDED cluster we can only view the data required skipping other data.
  • The data set is taking too much time to backup and restore.

By breaking the dataset over shards will MEAN having more resources available to handle the subset of data it owns, and operations of moving data across machines for replication, backups, restores will also be faster.



Discussion

No Comment Found