Courses / AWS
41. Sticky sessions / session affinity
What session affinity is, how sticky sessions work, and trade-offs for scaling.
Infrastructure as Code / Cloud (AWS)
Sticky sessions / session affinity
Sticky sessions (session affinity) keep a user's requests routed to the same backend instance so their session state stays consistent.
"I filled a shopping cart, but my next click hit a different server and the cart was empty."
Session affinity is a load-balancer feature that ties a client's requests to a specific backend (instance/container) for some duration, usually using a cookie or source IP, so in-memory session state or transient connections remain available.
"I filled a shopping cart, but my next click hit a different server and the cart was empty."
Session affinity is a load-balancer feature that ties a client's requests to a specific backend (instance/container) for some duration, usually using a cookie or source IP, so in-memory session state or transient connections remain available.