DVA-C02 · Question #380
A developer is designing a fault-tolerant environment where client sessions will be saved. How can the developer ensure that no sessions are lost if an Amazon EC2 instance fails?
The correct answer is C. Use Amazon DynamoDB to perform scalable session handling.. To survive EC2 instance failures, session state must be stored in an external, fault-tolerant data store rather than in instance memory. DynamoDB provides a managed, highly available key-value store ideal for session data.
Question
A developer is designing a fault-tolerant environment where client sessions will be saved. How can the developer ensure that no sessions are lost if an Amazon EC2 instance fails?
Options
- AUse sticky sessions with an Elastic Load Balancer target group.
- BUse Amazon SQS to save session data.
- CUse Amazon DynamoDB to perform scalable session handling.
- DUse Elastic Load Balancer connection draining to stop sending requests to failing instances.
How the community answered
(41 responses)- A2% (1)
- B12% (5)
- C78% (32)
- D7% (3)
Why each option
To survive EC2 instance failures, session state must be stored in an external, fault-tolerant data store rather than in instance memory. DynamoDB provides a managed, highly available key-value store ideal for session data.
Sticky sessions route a client to the same EC2 instance, so if that instance fails, the session stored in memory is lost along with it.
Amazon SQS is a message queuing service designed for decoupling components, not for storing and retrieving key-value session data.
Amazon DynamoDB is a fully managed, highly available NoSQL database that stores session data outside the EC2 instance. If an instance fails, any other healthy instance can retrieve the session from DynamoDB, ensuring no session data is lost.
Connection draining gracefully stops new requests to a failing instance but does not persist or recover session data stored in instance memory.
Concept tested: External session state management with DynamoDB
Source: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-session-handling.html
Community Discussion
No community discussion yet for this question.