Should you even use Sticky Sessions?
Sticky sessions make sure a user is always directed to the same server instance for every request they make.
With sticky sessions, a user’s request goes to the same server instance as long as it is up. It doesn’t matter how many instances may be running.
But there are a couple of downsides to this.
👉 Sticky sessions will stick. Hence the name.
They sort of defeat the purpose of a load balancer.
With sticky sessions, multiple users might get stuck to one instance while another instance doesn’t get any requests.
Not a great thing for resource utilization.
👉 The session is gone if the server goes down
Since the session is usually stored in memory, it’s tied to the life of the server instance.
Of course, the user is re-directed to another server but the session info is gone.
This might mean that the user needs to log in once more or the shopping cart they had created is wiped out.