MongoDB & NoSQL (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What are Chunk Splits and the Balancer process in MongoDB Sharding?
senior LevelSystem DesignDatabases & SQL
In Simple Words: Sharded data is divided into contiguous ranges called Chunks (default size: 64 MB):
- Chunk Split: When a chunk exceeds 64 MB, the primary shard splits it into two smaller chunks.
- The Balancer: A background thread running on the Config Server that monitors chunk distribution across shards:
- If the chunk count difference between shards exceeds a migration threshold, the balancer moves chunks from the busiest shard to the least busy shard over the network.