Sticky Sessions Pattern
ELI5 — The Vibe Check
Sticky Sessions route all requests from the same user to the same backend server. Once you connect to Server A, you always go to Server A. Useful when servers hold state (sessions, caches), but it makes scaling harder because you can't freely distribute traffic. It's a love-hate relationship.
Real Talk
Sticky sessions (session affinity) bind a client to a specific backend server using cookies, IP hash, or connection-based routing. This ensures stateful interactions (server-side sessions, local caches) work correctly. The tradeoff is uneven load distribution and complications during server failures or scaling events.
When You'll Hear This
"Sticky sessions keep WebSocket connections on the same pod during the session." / "We moved to stateless JWT auth to eliminate the need for sticky sessions."