Load Balancer Session Persistence

Use session persistence with a load balancer to direct all requests originating from a single logical client to a single backend web server.

Session persistence is a method to direct all requests originating from a single logical client to a single backend web server. Backend servers that use caching to improve performance, or to enable log-in sessions or shopping carts, can benefit from session persistence.

You enable session persistence when you create a load balancer or when you create a backend set. You can also edit an existing backend set to enable, disable, or change the session persistence configuration.

Sticky Cookies

The Load Balancer service offers two mutually exclusive cookie-based configurations for enabling session persistence:

Note

IP Address-driven Session Persistence

Some products offer session persistence support without cookies. These products depend on the IP address of the incoming request. ISP proxies and company exit gateways can issue many requests from a single IP address. In this case, a single backend server can be subject to high traffic volumes. Your backend fleet can become overwhelmed, one server at a time, even though effective load balancing is possible.

Another weakness of IP address-driven session persistence is that the originating IP address can change. In this case, session persistence can be lost or the request redirected to the wrong backend server.

Fallback

By default, the Load Balancer service directs traffic from a persistent session client to a different backend server when the original server is unavailable. You can configure the backend set to disable this fallback behavior. When you disable fallback, the load balancer fails the request and returns an HTTP 502 code. The service continues to return an HTTP 502 until the client no longer presents a persistent session cookie.

Important

If fallback is disabled, cookies with a distant future expiration date can cause a client outage.

The Load Balancer service considers a server marked drain available for existing persisted sessions. New requests that aren't part of an existing persisted session aren't sent to that server.