A company is designing a high-performance web application to track user activity logs. The application must write up to events per second, with each event payload containing a user ID, a timestamp, and action details. The read queries will be highly spiky and unpredictable, requiring sub-millisecond latency to display user dashboards. A solutions architect is designing the Amazon DynamoDB table for this workload. Which database configuration will provide the highest performance and efficiency?
- AConfigure the DynamoDB table with a partition key of `user_id` and a sort key of `timestamp`. Set the table capacity to Provisioned mode with static capacity limits, and use Amazon ElastiCache for Memcached to cache read queries.
- BConfigure the DynamoDB table with a partition key of `timestamp` formatted as `YYYY-MM-DD-HH` and a sort key of `user_id`. Set the table capacity to Provisioned mode with auto scaling enabled.
- Configure the DynamoDB table with a partition key of `user_id` and a sort key of `timestamp`. Set the table capacity to On-Demand mode, and deploy Amazon DynamoDB Accelerator (DAX) to cache read queries.Answer
- DConfigure an Amazon RDS for PostgreSQL database with a primary instance and multiple Read Replicas. Configure the application to write to the primary instance and route read queries to the Read Replicas, using the replicas as automatic failover targets.
Answer
Configure the DynamoDB table with a partition key of `user_id` and a sort key of `timestamp`. Set the table capacity to On-Demand mode, and deploy Amazon DynamoDB Accelerator (DAX) to cache read queries.
The correct configuration uses a high-cardinality partition key (`user_id`) combined with a sort key (`timestamp`) to distribute writes evenly across multiple partitions. Utilizing On-Demand capacity mode allows DynamoDB to handle unpredictable and spiky read and write traffic without throttling or manual capacity planning. Amazon DynamoDB Accelerator (DAX) provides the required sub-millisecond latency for read operations by caching query results in-memory.
Step-by-Step Solution
Key Concept
High-Performing Database Solutions
Estimated Time:2m 0s