What if your favorite website forgot who you were every time you clicked a link?
Why Sticky sessions in HLD? - Purpose & Use Cases
Imagine a busy restaurant where customers are randomly sent to different waiters every time they order. Each waiter has to start from scratch, asking the same questions again and again.
This random assignment causes confusion and delays. Customers get frustrated repeating their orders, and waiters waste time understanding preferences. The service becomes slow and error-prone.
Sticky sessions solve this by always sending a customer to the same waiter. The waiter remembers previous orders, making service faster and smoother without repeating questions.
Load balancer sends requests randomly to any server.
Load balancer routes requests from the same user to the same server (sticky session).Sticky sessions enable consistent user experience by keeping user data tied to one server during their visit.
Online shopping sites use sticky sessions to keep your shopping cart intact as you browse different pages without losing items.
Random request routing causes repeated work and confusion.
Sticky sessions keep user requests tied to one server.
This improves speed, consistency, and user satisfaction.