Session loss across multiple servers is fixed by moving session state out of individual application instances and into a shared, centralized session store that every server can read and write.
Before the fix, a user's cart would disappear if the load balancer routed their next request to a different server; after adding Spring Session with Redis, every server reads the same session data, so the cart persists no matter which instance handles the request.
# application.properties
spring.session.store-type=redis
spring.redis.host=redis-cluster
spring.redis.port=6379A concise interview answer is
I'd centralize session storage using Spring Session backed by Redis, so every instance reads and writes the same session data instead of keeping it in memory. That removes the need for sticky sessions and means restarts or scaling events don't lose anyone's session.
Last updated: 16 July 2026
Previous question: How would you configure session clustering in a Spring Boot application?
Next question: Does choosing YAML over properties files affect application performance?