Bitzu

SAA-C03 ยท Containers and microservices

Stateless microservices

Stateless versus stateful workloads, moving session state to ElastiCache or DynamoDB, and multi-tier versus microservice architectures.

Key points

  • Stateless: no state on local disk or memory, so any copy answers any request.
  • Scale freely, replace failed copies without logging users out.
  • State in shared multi-AZ stores: sessions in ElastiCache, MemoryDB or DynamoDB, profiles in DynamoDB, files in S3, secrets in Secrets Manager.
  • Sticky sessions only hide local state.
  • Multi-tier splits by layer; microservices by business capability, deployed and scaled separately.

Source: https://docs.aws.amazon.com/wellarchitected/latest/framework/rel_mitigate_interaction_failure_stateless.html

Practice questions

Single choice

What makes a web service stateless?

  1. It runs inside a container instead of on a virtual machine
  2. It keeps no request-to-request data in local memory or on local disk
  3. It sits behind an Application Load Balancer with stickiness enabled
  4. It stores its session data on an attached Amazon EBS volume
Show answer

Answer: B. It keeps no request-to-request data in local memory or on local disk

A stateless service does not depend on data kept locally between requests, so any running copy can serve the next request. Running in a container or behind a load balancer does not by itself remove local state.

Select all that apply

Which services are suitable places to offload user session data so that web servers stay stateless?

  1. Amazon ElastiCache
  2. An instance store volume on each web server
  3. Amazon DynamoDB
  4. Amazon MemoryDB
  5. The EBS root volume of each web server
Show answer

Answer: A. Amazon ElastiCache, C. Amazon DynamoDB, D. Amazon MemoryDB

Amazon ElastiCache, Amazon DynamoDB and Amazon MemoryDB are shared stores that every server can reach, so sessions survive when a server goes away. An instance store volume and an EBS root volume belong to one instance, so the data is still local state.

True or false

Enabling sticky sessions on an Application Load Balancer turns a stateful web application into a stateless one.

Show answer

Answer: False

False. Stickiness only routes a user back to the same target, so the session still lives on that one server and is lost if it fails or is scaled in. Statelessness means moving the session to a shared store.

Practice 8 questions on this topic in Bitzu

Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.

Download on the App StoreGet it on Google Play

More SAA-C03 topics in this module