Q13: What is database replication, and how does it differ from sharding?
Replication copies the same data to multiple nodes to improve availability and read capacity. Sharding splits different subsets of data across nodes to distribute storage and workload. Systems can use both: each shard has replicas. Replication raises questions about lag, leader election, and stale reads; sharding raises questions about partitioning, routing, and cross-shard operations.
Key Takeaways
- Replication duplicates data; sharding partitions data.
- They solve different scaling problems and are often combined.