LESSON 14 / 20·2 min readIntermediate

Replication vs sharding: what is the difference?

01 Understand02 Recall03 Prepare

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.

PAUSE & RECALL

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.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

  • Describe distribution, access patterns and hot spots before saying a system can simply “add shards.”
Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Schema vs model vs document in Mongoose?

Adapted from 04_MONGODB_MONGOOSE.md · “Replication vs sharding: what is the difference?”. Examples are study fragments; framework behavior can depend on your version.