Write sharding is used in DynamoDB to:
Think about how DynamoDB handles many writes at once.
Write sharding spreads write load across partitions to avoid throttling and improve performance.
Suppose you have a table with 9 items and you apply write sharding with 3 shards by adding a shard key with values 0, 1, or 2. How many total items will be in the table after sharding?
Each original item is duplicated across shards with different shard keys.
Each of the 9 items is duplicated 3 times with different shard keys, so total items = 9 * 3 = 27.
Given a DynamoDB item with attribute shardCount, which update expression correctly increments it by 1?
UpdateExpression = ?
DynamoDB uses ADD to increment numeric attributes.
The ADD keyword increments numeric attributes atomically. Other options are invalid syntax.
Choose the best explanation for how write sharding optimizes write capacity in DynamoDB.
Think about how DynamoDB partitions data internally.
Write sharding distributes writes across different partition keys, preventing any single partition from becoming a bottleneck.
You implemented write sharding by adding a random shard key from 0 to 4 to each item. However, you still get throttling errors on writes. What is the most likely cause?
Code snippet:
shard_key = random.randint(0, 4) item['shard'] = shard_key put_item(item)
Check how DynamoDB partitions data based on keys.
If the shard key is not included in the partition key, DynamoDB does not distribute writes across partitions, causing hot partitions and throttling.