What replaces Cassandra node math? Calculate capacity units from item size and operation rate. Do not multiply by a replication factor or choose a physical partition count.
Define the workload
Continue the Messenger example: one million new messages per second, sustained. Assume ordinary, non-transactional writes to one table, with no secondary indexes in the initial calculation.
| Assumption | Value |
|---|---|
| Write rate | 1,000,000 new items per second |
| Complete item size | At most 1 KB, including keys and attribute names |
| History | Years, based on product requirements |
| Attachments | Object storage; the item contains references |
| Main query | Latest messages in a conversation, then paginate backward |
| Region | One AWS Region in the initial calculation |
DynamoDB uses 1 KB = 1,024 bytes for write-capacity sizing. Count the complete item. A 1 KB message body plus keys and metadata may cross the threshold and require two write units.
Calculate write capacity
One write capacity unit supports one ordinary write per second for an item up to 1 KB. Each item is rounded up independently.
WCU per ordinary write = ceil(item bytes ÷ 1,024) For items at most 1 KB: 1M writes/s × 1 WCU = 1M WCU Provisioned capacity at 70% target utilization: 1M ÷ 0.70 ≈ 1.43M WCU
| Complete item size | Units per ordinary write | Units/s at 1M writes/s |
|---|---|---|
| Up to 1 KB | 1 | 1M |
| Over 1 KB, up to 2 KB | 2 | 2M |
| Over 2 KB, up to 3 KB | 3 | 3M |
This is the base table only. Transactional writes consume twice the write units for the same item size. Secondary indexes and cross-region replication require separate accounting.
Do not multiply by RF 3. Regional replication is built into DynamoDB's service. You do not provision an RF setting or count replica mutations as you did for self-managed Cassandra.
Choose the capacity mode
You configure table capacity behavior rather than an EC2 instance count.
| Mode | What you configure | How to use it in this example |
|---|---|---|
| Provisioned | Read/write units, autoscaling targets, minimum and maximum capacity | Prepare about 1.43M WCU for the assumed writes; size reads separately |
| On-demand | Request-based billing, optional maximum throughput, sufficient warm throughput and quotas | Prepare for 1M write units/s plus the desired traffic margin; no provisioned WCU reservation |
Provisioned mode can suit predictable usage. On-demand reduces capacity management for variable usage. Compare costs for the actual traffic pattern; neither changes the need for evenly distributed keys.
The 70% target is our planning choice. Autoscaling reacts over time; set sufficient initial or minimum provisioned capacity before a known high-rate workload arrives.
Prepare quotas and warm throughput
Do this before switching on a million writes per second.
- Check the current table, index, and account quotas. Request increases for the chosen capacity and Region.
- Check the table's warm throughput, which indicates capacity ready to serve immediately.
- Pre-warm for a known jump if necessary, and wait for preparation to complete.
- For provisioned mode, configure enough provisioned capacity. For on-demand, ensure any configured maximum does not block the target.
- Prepare secondary indexes too, if present.
These are different controls. Warm throughput does not override quotas or a provisioned capacity limit. Explicit pre-warming may incur charges.
On-demand does not mean an arbitrary sudden traffic jump is guaranteed. Verify readiness and test a controlled ramp.
Create the table and key schema
DynamoDB has tables directly within an AWS account and Region. There is no Cassandra-style keyspace, seed list, or token configuration.
| Setting | Messenger choice |
|---|---|
| Table name | Messages |
| Partition-key attribute | PK, type String |
| Sort-key attribute | SK, type String |
| Capacity mode | Provisioned or on-demand |
| Other attributes | Added on individual items; no fixed columns required |
The application encodes conversation ID and a daily bucket into one partition-key attribute. A sortable timestamp plus a unique ID forms the sort key.
example-message.json · JSON
{
"PK": "CONV#123#DAY#2026-09-30",
"SK": "2026-09-30T12:34:56.123Z#message-abc",
"sender_id": "user-456",
"body": "See you at six."
}This is a plain JSON item illustration, not an AWS CLI request. Use consistent timestamp formatting and unique IDs. The actual string order defines the timeline; strict conversation sequencing would need an explicit sequencing design.
For a composite primary key, PK + SK uniquely identifies the item. Multiple items share a PK and differ by SK. DynamoDB also permits a simple primary key containing only the partition key.
Read conversation history efficiently
Use Query with an exact partition-key value. Set ScanIndexForward=false for descending sort-key order and paginate with LastEvaluatedKey.
PK = CONV#123#DAY#2026-09-30 Order = descending by SK Return a page, then continue with its pagination key Move into older day buckets when needed
Unlike the Cassandra example, there is no table-level CLUSTERING ORDER BY clause. The sort key defines order, and each Query chooses forward or reverse traversal.
Filtering after reading does not remove the read capacity consumed. Design keys and indexes around the queries instead of scanning the whole table.
The application needs a way to locate older populated buckets. A deterministic scheme or conversation metadata can help avoid probing long runs of empty dates.
Check key distribution and hot traffic
A partition-key value is a logical grouping. A physical partition is storage infrastructure managed by DynamoDB. They are not a one-to-one relationship, and you do not set the physical partition count.
A physical partition supports up to 1,000 write units/s and 3,000 read units/s. These are capacity units, not operations of arbitrary size.
1M write units/s ÷ 1,000 per physical partition = at least 1,000 partitions' worth of write capacity
This is a capacity sanity check, not a configuration command or a prediction of the exact number AWS will allocate. AWS may allocate more because of storage, headroom, and distribution.
Many conversations spread traffic. A single extremely busy conversation can still concentrate writes. Adaptive capacity helps uneven traffic, but it does not make one hot item or a narrow write range unlimited.
Shard exceptional conversations when necessary
CONV#123#DAY#2026-09-30#SHARD#0 CONV#123#DAY#2026-09-30#SHARD#1 CONV#123#DAY#2026-09-30#SHARD#2
Route messages across shards, for example with a stable hash of the message ID. Reads must query the shards and merge by sort key. A daily bucket bounds history, while the shard spreads current writes.
Size reads separately
For individual ordinary item reads, memorize:
| Read type | Capacity for an item up to 4 KB |
|---|---|
| Strongly consistent | 1 read capacity unit per read/s |
| Eventually consistent | 0.5 read capacity units per read/s |
| Transactional | 2 read capacity units per read/s |
Multiply by the appropriate size increments and rate. A Query reading many items has its own aggregate byte accounting; do not simply treat every returned row as a separate GetItem request.
Strongly consistent reads are available on the base table, but global secondary indexes provide eventually consistent reads. Choose consistency from the product requirements. Cache recent history when repeated reads justify it.
Count the additional work
Our 1M-unit estimate covers one ordinary write to the base table. Messenger also has conversation lists, unread state, search, and delivery. Decide which operations really need another database write.
| Feature | Scaling implication |
|---|---|
| Global secondary index | Additional write units and storage; its key distribution can create a bottleneck |
| Read cursor | Store a per-user/conversation position rather than changing every message |
| Search | Often a separate asynchronously maintained search system |
| BatchWriteItem | Up to 25 put/delete operations per call; fewer round trips, not fewer write units |
| Transactions | Extra capacity cost; use where atomic multi-item changes are required |
| Global tables | Cross-region replication and cost require a separate design |
A throttled GSI can apply backpressure to base-table writes. Batch requests can return unprocessed items; retry those with backoff. Do not resend successful entries blindly.
Plan years of retained history
DynamoDB grows storage without you adding nodes. The bytes and their cost still exist.
If each item is exactly 1,000 bytes: 1M items/s × 1,000 bytes = 1 GB/s One year at that sustained rate = 31.536 PB of item data
This uses decimal units for the volume example. Items exactly 1,024 bytes would produce about 32.29 PB/year. Actual billing also reflects storage overhead and indexes.
Do not multiply the regional table's storage bill by three for internal replication. Price the service's actual storage rules; additional Regions and indexes are separate.
No automatic expiry is required for message history. If you choose TTL, expiry is asynchronous and does not archive data. Preserve history elsewhere before relying on expiration, and define how users retrieve, search, edit, or delete old messages.
Connect clients and operate the table
Applications use an AWS SDK, Region, table name, and IAM permissions. They connect to the DynamoDB service endpoint. AWS handles the physical node routing.
Write path
- Generate a stable message ID and bucket.
- Write the item with its PK and SK.
- Handle throttling or transient failures with bounded retries and backoff.
- Notify recipients according to the chosen persistence acknowledgment contract.
Retries should target the same key. If overwriting an existing item is unacceptable, use a conditional write and handle the already-existing case deliberately. This does not make external notifications exactly once.
Monitor before choosing a lever
Track throttling reasons, consumed capacity, latency, hot keys, index capacity, and queue lag if ingestion is asynchronous. Validate item sizes and observe the actual units consumed.
The scaling levers
| Problem | Lever |
|---|---|
| Total request capacity exhausted | Increase provisioned capacity, adjust autoscaling bounds, or use on-demand |
| Known abrupt traffic jump | Prepare warm throughput and quotas in advance |
| Hot key or write range | Change key design, shard writes, or coalesce eligible updates |
| Repeated reads | Cache recent data and choose acceptable read consistency |
| Oversized items | Reduce item size; store attachments separately |
| Index throttling | Increase index capacity or redesign its keys |
| Too many round trips | Use bounded concurrency and supported batch APIs |
| Retention cost | Measure compression at the application/data-design level, reduce unnecessary attributes, or design a historical tier |
Batching reduces client overhead but does not discount item capacity units. More total table capacity does not cure an intrinsically hot access pattern.
The two-minute interview answer
“For one million ordinary writes per second with complete items up to 1 KB, I need one million write units per second. In provisioned mode, I'd target roughly 1.43 million WCU with headroom, arrange quota increases, and prepare warm throughput. I'd key messages by conversation and bucket with a sortable message ID, shard hot conversations, and size reads and indexes separately. AWS manages the nodes and regional replication. Years of retained history remains a storage-cost decision.”
Workload → units per operation → capacity mode → quotas and readiness → table keys → hot-key checks → reads, indexes, and retention → load test.
Sources and scope
This is an interview sizing model, not a load-tested deployment. The 70% utilization target is a planning assumption. Service quotas and prices should be checked for the intended Region.