DynamoDB interview question · Most asked
On-demand or provisioned capacity: how do you choose?
Summary
On-demand charges per request and scales automatically, suiting new, unpredictable or spiky workloads. Provisioned capacity (usually with auto scaling, optionally with reserved capacity) is cheaper for steady, predictable traffic but can throttle on sudden spikes that auto scaling cannot follow.
Longer Answer
Auto scaling reacts in minutes based on CloudWatch metrics, so short bursts can still throttle a provisioned table. On-demand tables handle large increases quickly but have scaling characteristics of their own (instant accommodation up to roughly double the previous peak), and you can set maximum throughput limits to cap cost.
A common approach: launch on on-demand, observe the traffic shape, and move steady high-volume tables to provisioned with auto scaling and reserved capacity. You can switch modes, with limits on how often.
Key Points
- On-demand: pay per request, spiky/unknown traffic.
- Provisioned + auto scaling: cheaper for steady load.
- Auto scaling lags short spikes.
- Measure, then decide.
More most-asked DynamoDB questions
- What are DynamoDB Streams, and how are they used?
- Query or Scan: what is the difference, and why avoid Scan?
- What is DynamoDB, and what workloads is it a good fit for?
- What is a hot partition, and how do you avoid one?
- 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?
- How do conditional writes work, and how do you implement optimistic locking in DynamoDB?