Replication vs sharding: what is the difference?
Understand the concept
Replication keeps copies of data so a system can recover from node failure, while sharding distributes different subsets of data across nodes. Replica sets improve redundancy; sharding spreads storage and workload. A sharded deployment can also replicate each shard, so these techniques are complementary.
Important ideas
-
Replication keeps copies for availability and failover.
-
Sharding splits data across servers to spread storage and traffic.
-
A poor shard key can send most writes to one shard or require queries across all shards.
-
A shard key that increases monotonically can concentrate new writes, while queries without useful shard-key filters may contact many shards.
Can you explain it without the notes?
Replication vs sharding: what is the difference?
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
Replication keeps copies of data so a system can recover from node failure, while sharding distributes different subsets of data across nodes. Replica sets improve redundancy; sharding spreads storage and workload. A sharded deployment can also replicate each shard, so these techniques are complementary.
Turn this concept into a clear answer.
- Describe distribution, access patterns and hot spots before saying a system can simply “add shards.”
Adapted from 04_MONGODB_MONGOOSE.md · “Replication vs sharding: what is the difference?”. Examples are study fragments; framework behavior can depend on your version.