Partitioning (Sharding)
maang.io System Design Series
Partitioning (sharding) splits a dataset too big for one machine across many, so each node owns a slice. The art is picking a partition scheme β hash (even spread, no range scans) vs range (scannable, but hot-spot prone) β and handling rebalancing and skewed "hot" keys without a full reshuffle. It pairs tightly with Consistent Hashing and Replication.
This deep dive comes in three parts:
- Foundations & Core Concepts β hash vs range partitioning and why
hash % Nis a trap. - Internals β rebalancing strategies, hot keys, secondary-index partitioning, and request routing, with worked numbers.
- Interview β Staff/Principal Q&A: choosing a partition key and taming skew.
Partitioning (Sharding) β Part 3: System Design & Interview Mastery
maang.io System Design Series
What is this?
You now understand partitioning from the scheme down to the routing map. This chapter is where that turns into offer-winning signal. Interviewers rarely ask "what is sharding?" β they hand you a system that obviously won't fit on one box and watch whether you reach for partitioning at the right moment, pick a key that matches the queries, and defend the trade-offs when they push on hotspots, rebalancing, and cross-partition reads. That reflex is the senior signal.
We'll do two things: see where partitioning shows up in real designs (with a diagram), then run a mock interview β for each question, what they're really asking, a model answer, and the senior line that signals you've shipped this for real.
The one-line idea: interviewers use partitioning to test whether you can choose a partition key from the query pattern, then live honestly with what that choice costs β hotspots, scatter-gather, rebalancing pain, and the queries your key makes expensive.
Sign in to continue reading
The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.
Sign in to read the full lesson