Sharding in MongoDB


Sharding In MongoDB

Sharding is the process of storing data records across multiple machines and it is MongoDB's approach to meeting the demands of data growth. As the size of the data increases, a single machine may not be sufficient to store the data nor provide an acceptable read and write throughput. Sharding solves the problem with horizontal scaling. With sharding, you add more machines to support data growth and the demands of read and write operations.

Why Sharding?

In replication, all writes go to master node

Latency sensitive queries still go to master

Single replica set has limitation of 12 nodes

Memory can't be large enough when active dataset is big

Local disk is not big enough

Vertical scaling is too expensive

Sharding in MongoDB

The following diagram shows the sharding in MongoDB using sharded cluster.
In the following diagram, there are three main components -

Shards - Shards are used to store data. They provide high availability and data consistency. In production environment, each shard is a separate replica set.

Config Servers - Config servers store the cluster's metadata. This data contains a mapping of the cluster's data set to the shards. The query router uses this metadata to target operations to specific shards. In production environment, sharded clusters have exactly 3 config servers.

Query Routers - Query routers are basically mongo instances, interface with client applications and direct operations to the appropriate shard. The query router processes and targets the operations to shards and then returns results to the clients. A sharded cluster can contain more than one query router to divide the client request load. A client sends requests to one query router. Generally, a sharded cluster have many query routers.


Post a Comment

  1. let’s download the latest version of monster legends mod apk V9.2.2 for Android with offers unlimited coins, gems & everything. What do you think first when you hear about ‘monsters?’ Deadly devils that are thirsty for blood and ugly creatures full of strength and cruelty. But these terms alone do not define monsters as a whole. Monsters are also known for their thrill and mysterious nature.
    visit monster-legends-mod-apk

  2. This will be the proper weblog for anybody who hopes to find out about this topic. You recognize a great deal its nearly challenging to argue with you (not too I just would want…HaHa). You certainly put a fresh spin using a topic thats been revealed for a long time. Wonderful stuff, just wonderful! web designer la

  3. I have to convey my respect for your kindness for all those that require guidance on this one field. Your special commitment to passing the solution up and down has been incredibly functional and has continually empowered most people just like me to achieve their dreams. Your amazing insightful information entails much to me and especially to my peers. Thanks a ton; from all of us. converting websites

Post a Comment