A developer is designing a high-traffic web application that will be deployed on Amazon ECS. The application requires a highly available session state store that can handle complex data structures, such as lists and sets, with sub-millisecond latency. The session data must be replicated across multiple Availability Zones, and any session that is inactive for more than 2 hours must be automatically removed.
Which TWO solutions or configurations should the developer implement to meet these requirements?
- Use Amazon ElastiCache for Redis with a multi-node cluster configuration across multiple Availability Zones.Cevap
- Use the Redis EXPIRE command to set a Time to Live (TTL) of 7200 seconds on each session key when it is created or updated.Cevap
- CUse Amazon Cognito Identity Pools to store and synchronize the user session state data directly across the ECS tasks.
- DStore the session states in an Amazon DynamoDB table and implement a scheduled AWS Lambda function that performs a Scan operation every hour to locate and delete expired sessions.
- EStore the session states in Amazon Systems Manager Parameter Store and configure Parameter Store policies to delete the parameters after 2 hours.
Cevap
Use Amazon ElastiCache for Redis with a multi-node cluster configuration across multiple Availability Zones, and use the Redis EXPIRE command to set a Time to Live (TTL) of 7200 seconds on each session key.
The developer should use Amazon ElastiCache for Redis and the Redis EXPIRE command. Amazon ElastiCache for Redis is an in-memory database that natively supports complex data structures (like lists and sets), features multi-AZ replication for high availability, and provides sub-millisecond latencies. Setting a TTL of 7200 seconds (2 hours) using the Redis EXPIRE command handles the automatic expiration of inactive sessions cleanly and natively within the cache.
Adım Adım Çözüm
Anahtar Kavram
Selecting ElastiCache for Redis for high-availability session caching with complex data structures and managing expiration via TTL.