If you have ever done research on load-balancing solutions, you may have come across the term “sticky session.” A sticky session is a method that makes it so that a user will always be sent to the same server node. In turn, the server node contains all user-relevant information, such as their activity on their website during their session. This functionality can be attractive, given that, when a server knows how a user interacts with a site, it can reuse that session repeatedly, not having to create a brand-new session all over again.
Benefits of Session Stickiness
Configuring sticky sessions can boost the performance of your application. It can keep data exchange to a minimum, by reducing the number of times your servers need to exchange session data. Sticky sessions also increase server responsiveness by allowing the servers to utilize their RAM cache more effectively.
Session Persistence Using Cookies
Session persistence based on cookies can be based on one of two methods, either duration-based or application-controlled.
• Duration-Based
Duration-based session persistence is created when your load balancer issues a cookie for a specific timeframe. Then each time the load balancer receives a new client request, it checks for the cookie. After the specified duration that the load balancer define expires, the session is no longer sticky.
• Application-Controlled
With this method of session persistence, your application will generate the cookie with the specified duration. Your load balancer may issue its own cookie in addition—however it will follow the duration specified by the application cookie. Application-controlled sticky sessions are more efficient because they ensure that user requests are never routed to a server after the local session cookie expires. However, since application-controlled session persistence is a more complex configuration requiring integration between the application and load balancer, it should be set up by a professional.
Sticky Sessions and the Load Balancer
You might be wondering how sticky sessions might affect load balancing. Well, let us tell you the two things that are being balanced here: the server nodes and the group of intelligence servers (the server where session information is created from). These two perform separately from each other, meaning that they are balanced independently. Focusing on web server nodes, it is not possible to direct every user request to a server node with the least amount of load dynamically. However, it all will be initially load-balanced, meaning that this is not a problem to begin with.
Load Balancing by Resonate
So, should you enable sticky sessions in your web application load balancer? Yes! With it, you can ensure that your web server nodes are balanced to allow your users to enjoy the best user experience. To learn more about our load balancing software and how sticky sessions can be configured to benefit your business, contact us today.