Your app servers need sticky sessions, which breaks autoscaling. How do you fix it?
BeginnerScenarioScaling and performance
Answer
Situation read → State held in the app's memory ties users to one instance. Scaling in drops sessions, scaling out doesn't rebalance.
What I'd do →
- Move session state out of the process: Redis or ElastiCache, or stateless JWT tokens.
- Remove stickiness from the load balancer once sessions are external.
- If it can't be removed yet, use ALB duration-based stickiness with a short duration and connection draining, and accept some rebalancing cost.
- Test: kill a pod mid-session and confirm the user stays logged in.
Why → Stateless app tiers are what make horizontal scaling and zero-downtime deploys work.
Interview tip → Say "externalise the state" before discussing load balancer settings.
More on Scaling and performance
Traffic is expected to 10x for a sale next week. How do you prepare the platform?IntermediateThe HPA is configured but pods don't scale even though the app is slow. Why?BeginnerPods are Pending during a traffic spike because the cluster is out of capacity. What do you do now and long term?IntermediateThe database CPU is at 95% and the API is timing out. What's your approach?Intermediate"Too many connections" errors from Postgres after scaling the app out. How do you fix it?IntermediateLatency is fine on average but p99 is terrible. Where do you look?Advanced