DynamoDB Read and Write Capacity, Consistency Models, and Performance
DynamoDB performance depends on how many reads and writes your table can handle, how large your items are, which consistency model you choose, and whether your traffic is predic…
Introduction
DynamoDB performance depends on how many reads and writes your table can handle, how large your items are, which consistency model you choose, and whether your traffic is predictable or spiky.
Imagine a movie ticket booking application. On a normal day, 5,000 users access the application every minute. When booking opens for a blockbuster movie, 3 million users log in, 500,000 users search for seats, and thousands of payments happen every second. Traditional databases often require manual server upgrades, replicas, load balancing, and close CPU or memory monitoring.
DynamoDB removes much of that infrastructure work, but you still need to understand capacity units, billing modes, consistency, throttling, and cost behavior to design production-ready systems.
Purpose of this lesson
By the end of this lesson, you will understand Read Capacity Units, Write Capacity Units, On-Demand and Provisioned capacity modes, strong and eventual consistency, adaptive capacity, throttling, throughput calculations, and cost optimization.
Understanding the topic
Capacity represents how many read and write operations your DynamoDB table can process. Think of it like road capacity: a two-lane road handles limited traffic, while a six-lane highway can handle much more.
Capacity Units
How DynamoDB Measures Throughput
Read Capacity Unit (RCU)
readsWrite Capacity Unit (WCU)
writes| Operation | Capacity Rule | Important Detail |
|---|---|---|
| Strong Read | 1 RCU per read up to 4 KB | Latest committed data |
| Eventually Consistent Read | 1 RCU per 2 reads up to 4 KB | Cheaper and higher throughput |
| Write | 1 WCU per write up to 1 KB | Rounds up by item size |
Internal architecture
DynamoDB supports two capacity modes. On-Demand is best when traffic is unpredictable. Provisioned Capacity is useful when traffic is predictable and you want tighter cost control.
On-Demand Capacity
AWS Adjusts Automatically
Best for new apps, seasonal traffic, startups, and event-driven workloads.
Provisioned Capacity
You Define RCUs and WCUs
Write Capacity: 3000 WCUs
Best for stable enterprise workloads where usage is known and budget planning matters.
Data flow
Capacity calculations become straightforward when you know request volume, item size, and read consistency.
Throughput Calculation
2,000 Reads and 500 Writes per Second
Reads
2 KB item, eventually consistent reads.
= 1000 RCUs
Writes
2 KB item, 500 writes per second.
= 1000 WCUs
Visual explanation
DynamoDB offers two read consistency models. Use strong consistency only where correctness requires the latest committed value immediately.
Read Consistency
Strong vs Eventually Consistent Reads
Eventually Consistent
A read immediately after a write may briefly return older data while replicas synchronize.
- Lower cost
- Higher throughput
- Great for product catalogs, feeds, and recommendations
Strongly Consistent
A read returns the latest committed data after a successful write.
- Latest data
- Higher read cost
- Useful for balances, payment confirmation, and critical state
| Feature | Strong | Eventual |
|---|---|---|
| Latest data | Yes | Usually, after brief replication delay |
| Read cost | Higher | Lower |
| Throughput | Lower | Higher |
| Best use | Critical state | Most read-heavy application views |
Real-world use
Streaming platforms, ticketing systems, and flash-sale e-commerce apps often see unpredictable traffic spikes. On-Demand capacity is attractive for these workloads because the table can absorb sudden increases without pre-planning every spike.
- Netflix-style launches: new series releases create sudden read spikes for watch history, profiles, and recommendations.
- Ticket booking: blockbuster openings create huge bursts of seat searches and payment status checks.
- E-commerce sales: traffic may double or triple during festive campaigns.
- Enterprise systems: predictable business-hour usage may be cheaper with Provisioned Capacity plus Auto Scaling.
Scalability analysis
Adaptive Capacity helps when traffic is uneven. If one partition becomes busier than others, DynamoDB can automatically allocate more resources to reduce throttling and improve latency.
Uneven Traffic
Hot Access Pattern
Adaptive Capacity
Automatic Rebalancing Support
- Reduces throttling on busy partitions.
- Improves response time for uneven workloads.
- Requires no direct developer action.
Cost analysis
Good DynamoDB design is not only about speed. Item size, consistency choice, scans, and capacity mode directly affect AWS cost.
- Use eventually consistent reads whenever the latest value is not mandatory.
- Keep item sizes small and avoid unnecessary attributes.
- Prefer
QueryoverScan. - Choose On-Demand for unpredictable traffic.
- Choose Provisioned Capacity for predictable traffic.
- Enable Auto Scaling for provisioned tables.
- Monitor consumed capacity, throttled requests, and latency in CloudWatch.
Failure scenarios
Throttling occurs when incoming requests exceed available capacity. DynamoDB temporarily rejects some requests to protect the table and partitions.
Throttling
When Requests Exceed Capacity
Best practices
- Choose On-Demand for new applications until traffic patterns are known.
- Monitor consumed capacity regularly.
- Avoid scans in production request paths.
- Design efficient partition keys to distribute traffic.
- Enable Auto Scaling for Provisioned tables.
- Estimate throughput before deployment.
- Use CloudWatch alarms for capacity utilization and throttling.
- Use strong consistency only for workflows that truly require it.
Common mistakes
- Choosing Provisioned Capacity without traffic analysis.
- Ignoring throttling metrics.
- Reading large items unnecessarily.
- Using strong consistency for every query.
- Forgetting that item size affects capacity consumption.
- Using scans for high-traffic APIs.
Advanced interview questions
Interview Prep
Practice concise answers, then expand each card for the explanation.
1BeginnerQuestionWhat is an RCU?+
Answer
2BeginnerQuestionWhat is a WCU?+
Answer
3IntermediateQuestionWhat is the difference between On-Demand and Provisioned Capacity?+
Answer
4IntermediateQuestionWhat is Adaptive Capacity?+
Answer
5AdvancedQuestionWhat causes throttling in DynamoDB?+
Answer
Hands-on exercise
Design a DynamoDB capacity plan for an online shopping application with 10,000 reads per second, 2,000 writes per second, average item size of 2 KB, and traffic that doubles during festive sales.
- Should you use On-Demand or Provisioned Capacity?
- Calculate approximate RCUs and WCUs required.
- Would you enable Auto Scaling? Why?
- Which consistency model would you choose for product catalog, shopping cart, and payment confirmation?
- List three CloudWatch metrics you would monitor to ensure the table performs efficiently.
Summary
DynamoDB performance planning starts with capacity units. RCUs measure read throughput, WCUs measure write throughput, item size affects both, and consistency choice can double or halve read capacity needs. On-Demand mode simplifies unpredictable traffic, while Provisioned Capacity can reduce cost for stable workloads.
You also learned how Adaptive Capacity helps uneven traffic, how throttling happens, and how to optimize costs through smaller items, better access patterns, Auto Scaling, CloudWatch monitoring, and careful consistency choices.
Next: Lesson 5 covers creating and managing DynamoDB tables using the AWS Console, AWS CLI, and SDKs, plus primary key configuration, capacity modes, PITR, encryption, IAM, tagging, and lifecycle operations.