Why this app can't scale in
Each app server keeps its users' sessions in its own memory, so the load balancer is configured with sticky sessions to keep every user pinned to the server that has their data.
It works until it doesn't. Scaling out doesn't help the busy server, because its users are pinned to it. Scaling in logs people out, because their session dies with the instance. Deploys log people out too.
Boundaries, outermost first: Auto Scaling group: App server 3, App server 1 (FAILED: saturated), App server 2 Shared state: an empty slot for the session state Outside every boundary: Load balancer (no stickiness) Connections: Load balancer calls App server 1 — any server Load balancer calls App server 2 Load balancer calls App server 3 App server 1 calls session state — read/write session (step 1) App server 2 calls session state App server 3 calls session state