Session Stickiness in ELB
Explore the session stickiness in AWS Elastic Load Balancing (ELB) as a crucial feature for maintaining consistent user experiences in stateful applications.
We'll cover the following...
Session stickiness, also known as session affinity, is a feature of Elastic Load Balancing (ELB) that ensures a user’s requests are consistently routed to the same backend target for the duration of a session. This is crucial for stateful applications where data such as user authentication, shopping cart contents, or form entries must persist across multiple requests.
Each request might go to a different backend without stickiness, leading to inconsistent session data or forced re-authentication. Depending on the load balancer type, ELB solves this with mechanisms like cookies or connection tracking.
Session stickiness in ALB and NLB
In an Application Load Balancer (ALB), stickiness is typically cookie-based. AWS automatically creates an AWSALB
cookie, or we can define our application-based cookie. For Network Load Balancers (NLBs), stickiness uses source IP affinity (5-tuple hash) to consistently route connections from the same client to the same target.
By default, stickiness is disabled on ALBs and NLBs ...