Some applications store session state on the server. If a user's second request goes to a different server, they lose their session.
Sticky sessions solve this by routing all requests from the same user to the same server.
Implementation:
- Cookie-based: Load balancer sets a cookie identifying the server
- IP-based: Route by client IP (breaks with NAT)
Trade-off: Sticky sessions limit load balancing effectiveness. If one server gets all the heavy users, it overloads while others idle.
Better approach: Store sessions externally (Redis) and make servers stateless. Then any server can handle any request.