Course menuDVA-C02

Exams / DVA-C02 / Architectural patterns and decoupling / Question 2

DVA-C02 practice question: Architectural patterns and decoupling (2 of 2)

Development with AWS Services A free question from our original DVA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.

A web application runs on Amazon EC2 instances in an Auto Scaling group behind a load balancer. User shopping carts are held in each instance's memory. When the group scales in, some users lose their carts. What should the developer change so that any instance can serve any user?

Choose one answer.

  1. A. Store the session data in a shared external store such as Amazon ElastiCache.
  2. B. Increase the instance size so each instance can hold more sessions in memory.
  3. C. Turn off scale-in for the Auto Scaling group so instances are never terminated.
  4. D. Write the session data to the instance store volume of each instance.
Show the answer and explanation

Answer: A

  • A. Right: Correct. Moving session state out of the instances makes the web tier stateless, so instances can be added or removed without losing user data.
  • B. Wrong: Larger instances still keep the data locally. When an instance is terminated, its sessions are lost just the same.
  • C. Wrong: This avoids the symptom by giving up elasticity, and sessions are still lost if an instance fails.
  • D. Wrong: Instance store is also local to one instance and is lost when the instance stops or terminates.

Explanation

A stateless design keeps no client state on the compute layer. Putting sessions in a central, replicated store such as ElastiCache lets an elastic fleet scale in and out freely, which AWS describes as the ideal approach for session management.

Study

Keep practising

Answer questions with a score at the end, or practise just this topic with the explanation after each one. No sign-up needed.