A developer is designing a high-traffic, stateful web application that will be hosted on Amazon ECS. The application requires an external session store to maintain user session states across multiple container instances. The session store must meet the following requirements:
1. Provide sub-millisecond latency for both read and write operations.
2. Automatically delete session records that have been inactive for more than hours.
3. Ensure high availability and data persistence, even in the event of an Availability Zone (AZ) failure.
Which caching solution should the developer implement to meet these requirements?
- AAmazon DynamoDB with DynamoDB Accelerator (DAX) enabled, using DynamoDB Time to Live (TTL) to delete expired sessions.
- Amazon ElastiCache for Redis configured with a replication group across multiple Availability Zones, using Redis key expiration (TTL) to manage the session lifecycle.Cevap
- CAn AWS Lambda-based caching layer that stores session state in the function's local execution context, using a background thread to clean up inactive sessions.
- DAWS Systems Manager Parameter Store with standard parameters, using a scheduled task to rotate and delete session values after hours.
Cevap
Amazon ElastiCache for Redis configured with a replication group across multiple Availability Zones, using Redis key expiration (TTL) to manage the session lifecycle.
The correct answer provides sub-millisecond latencies for both read and write operations, which is a native capability of Amazon ElastiCache for Redis. Utilizing a replication group across multiple Availability Zones ensures data replication and automatic failover to survive AZ failures. Redis key expiration (TTL) handles active key purges immediately upon expiration, fitting the -hour cleanup constraint.
Adım Adım Çözüm
Anahtar Kavram
Application Caching and Session State Management