Sharding in 60 Seconds — How to Split a Billion Users
AI Images and video in this clip are AI-generated and are not real footage. Facts were checked against the sources below before publishing.
Transcript
- Can one database handle a billion users?
- Not easily. So you split the data across many databases. That's sharding, like library branches.
- One: the shard key. Like an author's last name, every book has one.
- Two: how to split. Range groups A to H. Hash spreads them evenly.
- Three: finding it. A router reads the key and sends you to the right branch.
- What if one branch gets slammed? Just build another?
- That's a hotspot. Go from three branches to four with simple hashing, and 75% of the books move.
- So we use consistent hashing. Put branches on a ring, and only about a quarter moves.
- Sharding splits the data. Replication copies it. In practice, you use both.
- Splitting is easy. Re-splitting is hard.
- Recap: shard key, range or hash, router.
- Changing a shard key means moving all your data. So pick it from your most common queries.
Sources
- Microsoft Learn, Azure Architecture Center, "Sharding pattern" (2026-04-02)
- MongoDB Manual, "Sharding" (확인 2026-10-27)
- MongoDB Manual, "Shard Keys" (확인 2026-10-27)
- MongoDB Manual, "Ranged Sharding" (확인 2026-10-27)
- MongoDB Manual, "Hashed Sharding" (확인 2026-10-27)
- Vitess Docs, "VTGate" (확인 2026-10-27)
- Apache Cassandra Documentation, "Dynamo" (architecture, 확인 2026-10-27)
- MongoDB Manual, "Replication" (확인 2026-10-27)