Session persistence refers to directing a client’s requests to the same backend web or application server for the duration of a “session” or the time it takes to complete a task or transaction.
High‑traffic websites must support hundreds of thousands, if not millions, of users in a fast, reliable manner. IT organizations support these large volumes by grouping servers into what is often called a server farm. A load balancer sits in front of the server group and directs traffic to individual servers in a way that maximizes efficiency.
If a user browses your website for five minutes, she probably fetches information from multiple backend servers. Not accessing the same server every time can cause problems if the web browser or backend server tries to improve the web experience by storing information that enables the user’s next action to occur more quickly. In this case, it is important – not to say imperative – that all of the user’s requests are sent to the same server.
To boost performance, a backend server might cache data that a user has requested, as well as pre‑cache additional information it thinks a user might request. Often, what looks to the user like a single request, such as downloading a large document, is actually broken down and transmitted between the client and server as multiple request‑response transactions. The most efficient way for the user to receive the requested information is to access the server that has already cached it.
In other instances, a user might engage in a transaction that requires multiple steps such as filling out a form, purchasing a product, or upgrading his account. As the client and server exchange data, they need to store state information about the session (referred to as context) for the transaction to proceed smoothly. In this case, session persistence makes it much easier for transactions to complete successfully.
A load balancer or application delivery controller (ADC) sits in front of the server group and implements the logic that ties a user session to a specific server for as long as necessary.
NGINX Plus and NGINX are the best-in-class load‑balancing solutions used by high‑traffic websites such as Dropbox, Netflix, and Zynga. More than 350 million websites worldwide rely on NGINX Plus and NGINX Open Source to deliver their content quickly, reliably, and securely.
As a software‑based load balancer, NGINX Plus is considerably less expensive than hardware solutions with similar capabilities. NGINX natively manages session persistence in several ways, including using cookies and sticky routes.