A developer is designing a web application that will run on a fleet of Amazon EC2 instances. The application requires a session state store that can scale horizontally, support high-frequency reads and writes, and maintain low latency. The developer chooses to use Amazon DynamoDB to store the user session data. Which implementation strategy provides the most performant and cost-effective solution for retrieving session records?
- ACreate a parameter in AWS Systems Manager Parameter Store for each active session, utilizing Parameter Store rotation to evict expired sessions.
- Create a DynamoDB table with the session ID as the partition key, and use the GetItem API operation to retrieve session documents.Cevap
- CCreate a DynamoDB table with a generic partition key, and use the Scan API operation with a FilterExpression to locate the session ID.
- DCreate a DynamoDB table using a low-entropy attribute like 'UserStatus' as the partition key, and increase provisioned read capacity to resolve resulting throttling errors.
Cevap
Create a DynamoDB table with the session ID as the partition key, and use the GetItem API operation to retrieve session documents.
The correct option specifies using the session ID as the partition key and retrieving the session data via the GetItem API operation. This pattern allows DynamoDB to route the request directly to the partition containing the target item, achieving single-digit millisecond latency and minimizing read capacity unit consumption. This is the recommended best practice for high-throughput session state management.
Adım Adım Çözüm
Anahtar Kavram
Session State Management using Amazon DynamoDB