In the previous chapters, we have all concentrated on building a stateless cluster. That means we don't need to maintain a session for each user request, and a load balancer can freely choose a worker node to serve the user requests.
A stateless cluster is more flexible and can scale well, so it's always the first choice when we are building a cluster. In essence, HTTP is a stateless protocol, so it lacks the ability to maintain a session for user requests. To solve this problem, web servers usually pass a session ID to the users' web browsers to maintain a long conversation.
For example, if we are building an online shopping system, we have to maintain a shopping cart for each user. When a user is checking out his/her cart, the total price of the goods in the shopping cart will be calculated. All this data needs to be stored either on the server side or in the cookies of users' web browsers and the data needs to be held across multiple pages...