Question

Difficulty: EasyApplication Caching and Session State Management

A developer is designing a web application and wants to store user session states externally to make the application tier completely stateless. The session store must support high availability, scale horizontally, and allow fast key-value lookups. Which TWO of the following configurations should the developer implement? (Select TWO.)

  1. Store session states in Amazon DynamoDB using the user ID as the partition key, and retrieve sessions using Query operations.Answer
  2. Store session states in Amazon ElastiCache for Redis configured with multi-AZ replication.Answer
  3. C
    Store session states in AWS Secrets Manager and enable automatic rotation to manage session expiration.
  4. D
    Store session states in Amazon DynamoDB and use periodic Scan operations to retrieve specific session records.
  5. E
    Store session states in local Lambda execution context variables to persist data across all concurrent users.

Answer

Store session states in Amazon DynamoDB using the user ID as the partition key, and retrieve sessions using Query operations; and store session states in Amazon ElastiCache for Redis configured with multi-AZ replication.
The correct configurations involve using Amazon DynamoDB with a partition key Query lookup, which scales horizontally and provides low-latency key-value access, and Amazon ElastiCache for Redis with multi-AZ replication, which provides sub-millisecond latency and automatic failover for high availability.

Step-by-Step Solution

1
Identify the architectural requirements: externalized session state, high availability, horizontal scalability, and low-latency key-value lookups.
The target storage must be a distributed cache or a highly scalable NoSQL database optimized for key-value lookups.
This rules out local storage, relational databases (not optimized for rapid key-value session throughput), or secrets management services.
2
Evaluate Amazon DynamoDB and Amazon ElastiCache for Redis against the requirements.
Amazon DynamoDB with partition key Query operations and Amazon ElastiCache for Redis with multi-AZ replication meet all high-availability, scalability, and latency requirements.
DynamoDB scales horizontally and provides single-digit millisecond latency. Redis provides sub-millisecond latency and replication ensures high availability.
3
Eliminate incorrect options based on anti-patterns and misconfigured query structures.
Secrets Manager, DynamoDB Scan operations, and local Lambda execution contexts are eliminated due to inefficiency, wrong service use case, or incorrect scope of variable reuse.
Secrets Manager is for sensitive secrets, Scan is inefficient for point lookups, and Lambda local context does not share state across concurrent execution environments.

Key Concept

Decoupling application state using highly available, low-latency external data stores such as Amazon DynamoDB or Amazon ElastiCache.
Rate this question