System Design · Building Blocks · Topic 3 of 5
Databases: Replication & Sharding
4 questions.
Your progress0%
- 1st Visit
- 0/4
- 2nd Visit
- 0/4
- Revise
- 0/4
Overview
The database is usually the hardest part of a system to scale, because it holds state that must stay correct. Replication copies the same data to several machines to add read capacity and survive failures, while sharding splits data across machines so that each holds only part of it, adding write capacity and storage. This topic also covers choosing between relational and NoSQL stores. Signals include write volumes beyond what a single primary can handle, datasets larger than one machine, read-heavy traffic, and requirements for high availability across zones. In an interview, state your data model and access patterns first, then justify the database choice, the replication approach and the shard key.
Questions
| # | Problem | Platform | Difficulty | Open | 1st1st Visit | 2nd2nd Visit | RevRevise |
|---|---|---|---|---|---|---|---|
| 1 | How do you choose between a SQL and a NoSQL database? | Concept | Easy | Read the answer to How do you choose between a SQL and a NoSQL database? | |||
| 2 | What is database replication, and how do synchronous and asynchronous replication differ? | Concept | Medium | Read the answer to What is database replication, and how do synchronous and asynchronous replication differ? | |||
| 3 | What is sharding, and how do you choose a shard key? | Concept | Medium | Read the answer to What is sharding, and how do you choose a shard key? | |||
| 4 | What problems does sharding introduce, and how are they handled? | Concept | Hard | Read the answer to What problems does sharding introduce, and how are they handled? |