On-demand vs provisioned cost comparison in DynamoDB - Performance Comparison
When using DynamoDB, it's important to understand how costs grow as your data and traffic increase.
We want to see how the cost changes when using on-demand versus provisioned capacity modes.
Analyze the cost behavior of these two capacity modes.
// On-demand mode: charges per request
// Provisioned mode: charges per capacity unit reserved
// Example usage:
// On-demand: pay for each read/write request
// Provisioned: pay fixed units, regardless of usage
This shows how DynamoDB charges differently based on your capacity mode choice.
Look at what causes costs to repeat or grow.
- Primary operation: Number of read/write requests made to the database.
- How many times: Each request counts separately in on-demand mode; fixed in provisioned mode.
Costs grow differently depending on mode and request volume.
| Request Volume (n) | On-demand Cost | Provisioned Cost |
|---|---|---|
| 10 | Low (pay per request) | Fixed (capacity units reserved) |
| 100 | Moderate (more requests, more cost) | Fixed (same reserved units) |
| 1000 | High (cost grows with requests) | Fixed or may need to increase capacity |
Pattern observation: On-demand cost grows linearly with requests; provisioned cost stays fixed until capacity is increased.
Time Complexity: O(n) for on-demand mode cost growth
This means cost grows directly with the number of requests you make.
[X] Wrong: "Provisioned mode cost grows with every request just like on-demand."
[OK] Correct: Provisioned mode charges a fixed rate for reserved capacity, not per request, so cost stays stable until you increase capacity.
Understanding how costs scale with usage helps you design efficient and cost-effective DynamoDB solutions.
What if you switch from on-demand to provisioned mode but your request volume suddenly doubles? How would the cost behavior change?