DynamoDB Capacity Optimization for Preventing Throttling

Preventing Throttling in DynamoDB Capacity Optimization

Question

KindleYou is a location-based social search mobile app that allows users to like or dislike other users, and allows users to chat if both parties liked each other in the app.

It has more than 1 billion customers across the world. They use DynamoDB to support the mobile application and S3 to host the images and other documents shared between users. DynamoDB has a table with 60 partitions and is being heavily accessed by users.

There are lots of hot partitions.

To better accommodate uneven access patterns, how will DynamoDB use its capacity to prevent throttling?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer: B.

Option A is incorrect.

DynamoDB provides some flexibility in your per-partition throughput provisioning by providing burst capacity.

DynamoDB reserves a portion of that unused capacity for later bursts of throughput to handle usage spikes.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key-partitions-adaptive

Option B is correct.

Adaptive Capacity enables your application to continue reading and writing to hot partitions without being throttled, provided that traffic does not exceed your table's total provisioned capacity or the partition maximum capacity.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key-partitions-adaptive

Option C is incorrect.

The partition key portion of a table's primary key determines the logical partitions in which a table's data is stored.

Provisioned I/O capacity for the table is divided evenly among these physical partitions.

Therefore a partition key design that doesn't distribute I/O requests evenly can create "hot" partitions that result in throttling and use your provisioned I/O capacity inefficiently.

use your provisioned throughput more efficiently as the ratio of partition key values accessed to the total number of partition key values increases.

This design is more useful for these specific partition keys like USERID where the application has many users and DEVICE ID where each device accesses data at relatively similar intervals.

This involves re-designing or be cautious during design and handle specific workloads.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-uniform-load.html

Option D is incorrect.One way to better distribute writes across a partition key space in DynamoDB is to expand the space which can be done in several different ways.This includes adding a random number to the partition key values to distribute the items among partitions, or use a number that is calculated based on something that you are querying on.

This involves re-designing or be cautious during design and handle specific workloads.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-sharding.html

KindleYou is a social search mobile app that uses DynamoDB to support its functionality and S3 to store images and other shared documents between users. DynamoDB is a fully managed NoSQL database service provided by AWS. It is designed to provide scalable performance and high availability with no operational overhead.

DynamoDB stores data in tables, and each table consists of one or more partitions. Each partition is a collection of items that share the same partition key value. DynamoDB uses partitioning to distribute the table's data across multiple physical storage partitions, and it scales automatically to handle the amount of traffic and storage needed by the application.

However, if the access patterns to the table are uneven, some partitions may become "hot" and receive more requests than others, causing throttling and affecting the overall performance of the application. To prevent this, DynamoDB provides two solutions: Burst Capacity and Adaptive Capacity.

Burst Capacity is a feature that allows DynamoDB to accommodate sudden traffic spikes for a short duration. It provides extra read and write capacity on top of the provisioned capacity for a limited time, using unused capacity from other partitions in the same table.

Adaptive Capacity, on the other hand, is a feature that allows DynamoDB to automatically adjust the provisioned capacity of a table in response to changing application traffic. It continuously monitors the application's workload and adjusts the capacity based on the number of read and write requests, and the size of the data stored.

Designing the partition keys to distribute the workload evenly is another solution to avoid hot partitions. A good partition key should distribute the data evenly across partitions, ensuring that the read and write requests are evenly distributed. If the partition key is not designed correctly, the table's data may be skewed, and some partitions may receive more requests than others.

Using Write Sharding to distribute the workload evenly is another approach to avoid hot partitions. Write sharding is a technique where the application splits the data into smaller pieces and distributes them across multiple partitions using a sharding algorithm. This ensures that the write requests are distributed evenly, and no single partition receives too many requests.

In conclusion, DynamoDB provides several solutions to prevent throttling caused by uneven access patterns, including Burst Capacity, Adaptive Capacity, designing the partition keys to distribute the workload evenly, and using Write Sharding to distribute the workload evenly. The best solution depends on the specific use case and workload pattern of the application.