A developer is optimizing a high-traffic web application that stores user session data in an Amazon DynamoDB table. The application frequently retrieves session data by searching for the user's email address, which is not the table's primary key. During peak traffic hours, the application logs show numerous ProvisionedThroughputExceededException errors and users experience high latency. Which TWO actions should the developer take to resolve these issues and improve performance? (Select TWO.)
- Configure a Global Secondary Index (GSI) on the DynamoDB table with the email address as the partition key, and use the Query API instead of the Scan API to retrieve session data.Answer
- Implement Amazon ElastiCache for Redis to store and manage active user session states, offloading the frequent read and write operations from the DynamoDB table.Answer
- CScale up the provisioned write and read capacity units (WCUs and RCUs) on the DynamoDB table to accommodate the increased traffic during peak hours.
- DImplement a scheduled AWS Lambda function that performs a daily Scan operation on the DynamoDB table and caches the session data in Amazon Systems Manager Parameter Store.
- EHardcode the database and cache credentials in the application's source code and pass them directly during the AWS SDK client initialization.
Answer
Configure a Global Secondary Index (GSI) on the DynamoDB table with the email address as the partition key to Query the data, and implement Amazon ElastiCache for Redis to store and manage active user session states.
The correct options are to configure a Global Secondary Index (GSI) on the DynamoDB table with the email address as the partition key, using the Query API instead of the Scan API, and to implement Amazon ElastiCache for Redis to store and manage active session states. A GSI allows querying on the non-key email attribute efficiently, while ElastiCache for Redis provides an in-memory store that handles frequent session writes and reads with sub-millisecond latency.
Step-by-Step Solution
Key Concept
Optimizing session state storage and application performance using Amazon DynamoDB Global Secondary Indexes and Amazon ElastiCache for Redis.