Question

Difficulty: MediumHigh-Performing Database Solutions

A solutions architect is designing a high-throughput telemetry application on AWS. Thousands of IoT devices will send real-time environmental data every second. The architect decides to store the data in an Amazon DynamoDB table. The database schema is currently designed with `SensorType` (which has 4 unique values: 'Temperature', 'Humidity', 'Pressure', and 'AirQuality') as the partition key, and a timestamp as the sort key. During load testing, the application encounters write throttling errors even though the table has sufficient write capacity. Which modification to the database design should the solutions architect recommend to resolve the performance bottleneck?

  1. Redesign the table schema to use a high-cardinality attribute, such as a combination of `SensorID` and a daily date string, as the partition key to distribute write operations evenly across multiple partitions.Answer
  2. B
    Keep the current partition key but change the sort key to `SensorID` to allow DynamoDB to distribute the incoming write load across multiple partitions based on the sort key.
  3. C
    Switch the DynamoDB table from provisioned capacity mode to on-demand capacity mode to automatically scale and bypass partition-level throughput limitations.
  4. D
    Migrate the database layer to an Amazon RDS Multi-AZ DB cluster and direct the write traffic to the read replicas to scale the write throughput.

Answer

Redesign the table schema to use a high-cardinality attribute, such as a combination of `SensorID` and a daily date string, as the partition key to distribute write operations evenly across multiple partitions.
The correct option is to redesign the table schema using a high-cardinality attribute. By using a partition key with high cardinality (such as `SensorID` or a combination of `SensorID` and a date), DynamoDB can distribute the write workload evenly across many physical partitions. This avoids hitting the partition-level limit of 1,000 Write Capacity Units (WCUs).

Step-by-Step Solution

1
Analyze the write workload and partition structure.
Identify that the current partition key `SensorType` has only 4 unique values, causing all writes to be concentrated on at most 4 partitions.
DynamoDB determines physical partition allocation by hashing the partition key.
2
Evaluate the partition limits.
Recognize that each physical partition has a maximum limit of 1,000 Write Capacity Units (WCUs). Due to the low cardinality of `SensorType`, the partition capacity is exceeded, causing throttling.
Understanding physical DynamoDB limits is necessary to identify bottlenecks.
3
Redesign the primary key for optimal distribution.
Recommend using a high-cardinality partition key like `SensorID` (optionally with a date suffix) to spread the writes across many partitions.
Distributing writes evenly prevents any single partition from exceeding the 1,000 WCU limit.

Key Concept

DynamoDB partition key cardinality and partition-level throughput limits
Estimated Time:1m 30s
Rate this question