AdvancedScenario
15 min
Hot Partition in a Sharded Database
DatabasesShardingScalability
Advertisement
Interview Question
Throughput bottlenecks appear on a subset of shards. Outline your approach to identify and mitigate hot partitions.
Key Points to Cover
- Profile per-shard QPS/latency and key distribution
- Detect skewed keys or time-based partitions
- Rebalance/reshard; introduce better partition keys
- Add caching or read replicas for hotspot keys
- Backfill and migrate with minimal downtime
Evaluation Rubric
Profiles per-shard metrics and key skew35% weight
Chooses effective mitigation strategies25% weight
Minimizes migration risk/downtime20% weight
Prevents future skews20% weight
Hints
- 💡Hash+range composite keys can help.
Common Pitfalls to Avoid
- ⚠️Focusing solely on QPS without considering latency or resource utilization.
- ⚠️Not analyzing the underlying data and access patterns to understand *why* a partition is hot.
- ⚠️Implementing rebalancing without considering the long-term impact of the chosen partition key.
- ⚠️Ignoring the potential for cascading failures if hot partitions are not addressed promptly.
- ⚠️Making arbitrary changes to partition keys without thorough testing and rollback plans.
Potential Follow-up Questions
- ❓How do you do online resharding?
- ❓What about secondary index hotspots?
Advertisement