0
0
HLDsystem_design~3 mins

Why Sticky sessions in HLD? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your favorite website forgot who you were every time you clicked a link?

The Scenario

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.

The Problem

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.

The Solution

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.

Before vs After
Before
Load balancer sends requests randomly to any server.
After
Load balancer routes requests from the same user to the same server (sticky session).
What It Enables

Sticky sessions enable consistent user experience by keeping user data tied to one server during their visit.

Real Life Example

Online shopping sites use sticky sessions to keep your shopping cart intact as you browse different pages without losing items.

Key Takeaways

Random request routing causes repeated work and confusion.

Sticky sessions keep user requests tied to one server.

This improves speed, consistency, and user satisfaction.