Soru

Zorluk: OrtaApplication Caching and Session State Management

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?

  1. A
    Create a parameter in AWS Systems Manager Parameter Store for each active session, utilizing Parameter Store rotation to evict expired sessions.
  2. Create a DynamoDB table with the session ID as the partition key, and use the GetItem API operation to retrieve session documents.Cevap
  3. C
    Create a DynamoDB table with a generic partition key, and use the Scan API operation with a FilterExpression to locate the session ID.
  4. D
    Create 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

1
Identify the requirements of the session state store.
The store must scale horizontally, support high-frequency reads and writes, and maintain low latency.
This establishes the constraints for database lookup operations.
2
Evaluate DynamoDB key design and access patterns.
A unique session ID partition key allows direct item lookup via GetItem, whereas a low-entropy partition key causes hot partitions, and a Scan operation reads the entire table.
Selecting the right partition key and API call minimizes both latency and consumed read capacity units.
3
Select the optimal architectural pattern.
Retrieve session records using GetItem with a session ID partition key, avoiding inappropriate stores like Parameter Store.
This satisfies all performance, cost, and scalability requirements.

Anahtar Kavram

Session State Management using Amazon DynamoDB
Bu soruyu puanla