QamoosTech
Architecture & DesignScaling and performanceIntermediate

Sticky Sessions

PronunciationSTIK-ee SESH-unz

Definition

Sticky sessions make a load balancer send all requests from the same user to the same server, usually using a cookie, so the server's in-memory session keeps working.

Where you hear it

In load balancer settings, scaling reviews, and discussions about why logins disappear after a deploy.

Examples

  • Enable sticky sessions until we move sessions to Redis.
  • Users lose their cart when the sticky server restarts.
  • Sticky sessions keep the user on the same node, so the cart in memory stays visible.

Common mistake

Relying on them for good. Load becomes uneven and a server failure logs users out. Keep state in a shared store.

Don't confuse with

A stateless design, where any server can handle any request because nothing is kept locally.

Say it at work

  • In a meeting or chatDo we need sticky sessions here?
  • In an email or ticketMove the session to a shared store and drop stickiness.