
Answer-first summary for fast verification
Answer: Use Amazon ElastiCache for Redis to store the session state. Update the application to use ElastiCache for Redis to store the session state.
## Explanation **Correct Answer: B** - Use Amazon ElastiCache for Redis to store the session state. ### Why this is the correct solution: 1. **High Availability Requirement**: ElastiCache for Redis supports Multi-AZ with automatic failover, which provides high availability. If the primary node fails, it automatically fails over to a replica. 2. **Session State Management**: Redis is specifically designed for in-memory data storage with persistence options, making it ideal for session state storage. It offers: - Low latency (sub-millisecond response times) - Data persistence options - Built-in data structures optimized for session management 3. **Comparison with other options**: - **Option A (Memcached)**: While Memcached is also an in-memory cache, it lacks built-in persistence and high-availability features like Redis. Memcached is simpler but doesn't provide the same level of data durability. - **Option C (Storage Gateway)**: Storage Gateway is designed for hybrid cloud storage solutions, not for low-latency session state management. It would introduce unnecessary latency and complexity. - **Option D (RDS)**: While RDS provides high availability, it's a relational database designed for structured data, not for low-latency session state storage. It would be overkill and introduce unnecessary latency compared to an in-memory cache. ### Key Benefits of ElastiCache for Redis for Session State: - **Automatic failover**: With Multi-AZ enabled, Redis automatically fails over to a standby replica if the primary fails. - **Data persistence**: Can be configured to persist session data to disk. - **Low latency**: In-memory storage provides fast access to session data. - **Scalability**: Can scale horizontally with read replicas. - **Session sharing**: Multiple EC2 instances can access the same session data, eliminating the need for sticky sessions. ### Architecture Impact: By moving session state to ElastiCache Redis: 1. The Auto Scaling group can scale in/out without losing user sessions 2. Sticky sessions can be disabled on the ALB (though not required) 3. Users can be served by any EC2 instance in the pool 4. Session data survives individual web server failures This solution provides the high availability and session persistence required by the company while maintaining low latency for user experience.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A company runs a web application on Amazon EC2 instances in an Auto Scaling group behind an Application Load Balancer that has sticky sessions enabled. The web server currently hosts the user session state. The company wants to ensure high availability and avoid user session state loss in the event of a web server outage.
Which solution will meet these requirements?
A
Use an Amazon ElastiCache for Memcached instance to store the session data. Update the application to use ElastiCache for Memcached to store the session state.
B
Use Amazon ElastiCache for Redis to store the session state. Update the application to use ElastiCache for Redis to store the session state.
C
Use an AWS Storage Gateway cached volume to store session data. Update the application to use AWS Storage Gateway cached volume to store the session state.
D
Use Amazon RDS to store the session state. Update the application to use Amazon RDS to store the session state.