Partitioning & Sharding
Splitting data across nodes so that load and storage scale horizontally.
Distributed SystemsIntermediate7 hrs4 key ideas · 6 applied designs
0%
your progressOverview
Splitting data across nodes so that load and storage scale horizontally.
Key ideas
- Hash partitioning spreads load evenly but kills range scans; range partitioning keeps order but risks hot ranges.
- Consistent hashing with virtual nodes moves only ~1/N of keys when a node joins or leaves.
- Secondary indexes are either local (scatter-gather reads) or global (cross-partition writes).
- Hot keys need special handling: key splitting, caching, or request coalescing.
Trade-offs
- More partitions = more parallelism but more coordination for cross-partition queries.
- A shard key chosen for today's access pattern is expensive to change tomorrow.
In the real world
DynamoDB partition keysVitess for MySQLKafka topic partitions
Keywords
Consistent hashingVirtual nodesReshardingHot keys