DynamoDB interview question · Most asked
What is a hot partition, and how do you avoid one?
Summary
A hot partition receives far more traffic than others, usually because many requests share one partition key value (a celebrity user, today's date as key, a global counter). It throttles even when the table has spare capacity overall. Avoid it with high-cardinality keys and, for unavoidable hot keys, write sharding or caching.
Longer Answer
Techniques:
- Choose keys with many values and even access (user ID, not country).
- Write sharding: append a suffix (
EVENT#2026-10-17#7, suffix 0-9 chosen randomly or computed from an attribute) and read all shards in parallel. - Cache hot reads (DAX or an application cache).
- Aggregate writes (buffer counters in memory or a queue) instead of writing one item per event.
CloudWatch Contributor Insights shows the most accessed keys, which is how you find hot partitions in practice.
Key Points
- Traffic concentrated on one key.
- High-cardinality keys.
- Write sharding with suffixes.
- Cache hot reads; Contributor Insights to find them.
More most-asked DynamoDB questions
- What are DynamoDB Streams, and how are they used?
- How do conditional writes work, and how do you implement optimistic locking in DynamoDB?
- What is DynamoDB, and what workloads is it a good fit for?
- How do you approach data modelling in DynamoDB, and how is it different from relational design?
- Explain partition keys, sort keys and the two kinds of primary key.
- Global secondary index or local secondary index: what is the difference?
- Query or Scan: what is the difference, and why avoid Scan?
- DynamoDB or a relational database such as Aurora PostgreSQL: how do you decide?