internalsGet Pro

System Design · Module 05

Database scaling: read replicas, sharding and partitioning

Lessons
12
Free
0
Reading
~4 h

Your progress

0 / 12 lessons done

Sign in to track

Lessons

  1. Scaling a relational database: the optionsA slow database does not tell you which scaling option will help. You need to identify the constrained resource before changing capacity, routing or data placement.18 min
  2. Read replicas and replication lagRead replicas can take browsing traffic off a busy database. You need to know which reads can move, what a successful write promises, and how to stop stale data from breaking a user’s workflow.18 min
  3. Connection pooling: reusing database connectionsAdding app servers can exhaust database connections before the database runs out of query capacity. Pooling controls that pressure, but only when connection ownership, waiting and fleet-wide limits are explicit.18 min
  4. Sharding: splitting data across databasesSplitting a database changes more than storage capacity. It changes routing, transaction boundaries, failure recovery and the queries your service can answer cheaply.19 min
  5. Hot partitions: uneven load across shardsA database cluster can have spare capacity and still reject requests. You need to find the overloaded routing unit before adding machines or changing the data model.18 min
  6. Consistent hashing: adding servers without moving most dataAdding database capacity can create a second problem: relocating existing data. Consistent hashing limits changes in ownership, but you still need a safe way to move records and update routers.19 min
  7. Resharding: rebalancing data without downtimeAdding database capacity requires moving existing data while customers keep changing it. The difficult part is transferring ownership without losing acknowledged writes.20 min
  8. Distributed ID generation: unique IDs across machinesServices often need an identifier before saving data. Once several machines generate those identifiers, uniqueness depends on more than incrementing a counter.19 min
  9. UUID vs Snowflake IDs: choosing an ID formatAn ID format becomes part of database keys, URLs, events and support tools. Choosing it also means choosing the failures your system must prevent.18 min
  10. Ticket servers: generating IDs from a central counterA shared counter can give sharded databases unique integer IDs without depending on clocks. Its safety depends on preserving allocation history through retries, process restarts and database failover.19 min
  11. Clock skew: why server clocks disagreeClocks influence request deadlines, event histories and distributed IDs. A clock correction can expose assumptions that ordinary load testing never exercises.19 min
  12. Design: a URL shortener for millions of usersSmall lookup services become difficult when links must survive failures, traffic concentrates on one key, and cached answers outlive changes. This design connects database scaling techniques into one working system.30 min

Practise with

Terms this module teaches 44

Open glossary

Asynchronous replication

Replication where the source can acknowledge a committed write without waiting for a replica to acknowledge it.