Security Architecture

A load-balanced web application keeps shopping carts in each server's memory, and users lose their carts when a request reaches a different server. What should the architect configure?

Show the answer

Correct answerB. Session persistence on the load balancer

AWhy not this: Rebuilding servers from a clean image on each start does not control request routing, and it would discard in-memory state.

BWhy this is right: Session affinity pins a client to one backend, so the server holding the in-memory cart keeps receiving that user's requests.

CWhy not this: More CPU or RAM per server does not stop requests from landing on a server that lacks the user's cart.

DWhy not this: Spreading servers across regions improves resilience and latency but does not keep one user on one server.

Session persistence (sticky sessions) makes the load balancer send a user's requests to the same server, so the in-memory cart is found. Vertical scaling adds capacity to a server but does not change which server receives each request.