NoSQL · Data models beyond tables
What causes a hot partition and how do you fix it?
Short answer
A hot partition occurs when one key or a few keys receive disproportionate traffic, exceeding a single partition's capacity. Fix it with a higher-cardinality key, write sharding, caching or by splitting the hot entity.
Partitions have physical limits. Even if the cluster has spare capacity, one partition cannot use it. Common causes are monotonic keys such as timestamps, low-cardinality keys such as status, and celebrity or tenant skew where a few entities are far larger than the rest.
Detection
- Per-partition throughput and latency metrics, not just cluster averages
- Throttled requests concentrated on specific key ranges
- A single tenant or product with far more traffic than others
- Write amplification from a secondary index whose key is skewed
function saltedKey(entityId, bucketCount) {
const bucket = Math.floor(Math.random() * bucketCount);
return "ENTITY#" + entityId + "#" + bucket;
}
function bucketKeys(entityId, bucketCount) {
const keys = [];
for (let b = 0; b < bucketCount; b += 1) {
keys.push("ENTITY#" + entityId + "#" + b);
}
return keys;
}Write sharding helps writes but makes reads more complex, so use it only for genuinely hot keys. Another option is to cache the hot item in front of the database, or to split a large entity into smaller items that can be read independently. Each approach moves complexity somewhere else, so measure the trade-off.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1How would you detect a hot partition in production?
- 2What is write sharding and what does it cost on reads?
- 3Why is a timestamp a common cause of hotspots?
- 4Can a secondary index create a hot partition?
Say it in the interview
A hot partition is one key or a small set of keys getting far more traffic than a single partition can handle. I detect it with per-partition metrics and throttling patterns, not cluster averages. The fix depends on the cause: a better key for low cardinality, write sharding for a celebrity key, or caching in front of the hot item. Write sharding complicates reads because they must gather buckets, so I only use it where the write volume justifies that cost.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live NoSQL mock interview and get scored feedback on depth, clarity and confidence.