Sharding: How Splitting a Database Across Machines Works and Its Trade-offs

A single database server eventually hits limits on disk, CPU, and write capacity, and read replicas cannot relieve write load. Sharding splits data across many machines, each owning a slice, and is considered the last and most costly scaling option. The choice of shard key is critical: it must spread load evenly while also appearing in common queries, or the system suffers from scatter-gather queries or concentrated hot spots. The approach introduces costs including cross-shard queries, a routing layer to locate data, rebalancing when data moves, and distributed transactions. Engineers are generally advised to exhaust other optimizations before sharding.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in