09 - Sharding & Partitioning
The Scaling Problem
As data grows, a single database server eventually hits limits:
- CPU: Query processing, connection handling
- Memory: Cache, working set size
- Disk: Storage capacity, IOPS
- Network: Bandwidth for replication
Plain text
Single Server Limits:
┌─────────────────────────────────────────────────────────────┐
│ CPU │ ~64 cores, but can't parallelize single query │
│ Memory │ ~1TB RAM for cache │
│ Disk │ ~20TB NVMe, ~100K IOPS │
│ Network │ ~10 Gbps │
│ Connections│ ~1000 concurrent (more = slower) │
└─────────────────────────────────────────────────────────────┘
When you hit these limits, you need to scale out (shard/partition)