Sessions allow the web application to maintain the state across multiple requests. There are times when we need to store a lot of real-time session data. Saving the session data in a cookie is not always the best approach. So, it makes sense to move from cookie-based management to server-side session management. There is no limit to the amount of data we can store as session data. Typically, session data is stored in a temporary directory and the same variables are read on subsequent requests.
If we have to use a load balancer with multiple web servers behind it, we need to centralize the session information. If not, we will end up having an inconsistent experience for the user. Let's say that the first request from the user was directed to server A, which then created the required session variables. If the subsequent request is directed to Server B by the load balancer, the session variables are lost and will be initialized again.
To...