Level 1: Foundations · L1.3 Load balancing, reverse proxies, API gateways
Sticky sessions and stateless services
Explain why stickiness hurts balancing and how to move state out.
10 min · Free
What you take away
- Affinity overrides the balancing algorithm: once a user is pinned, load is distributed by who arrived when, not by who is busy.
- A newly scaled-out instance only receives new sessions, so it stays cold while the existing ones stay hot.
- Connection draining finishes in-flight requests; it cannot move a session that lives in one process's memory.
- Affinity is acceptable for warm caches and live connections — never for correctness.
How the class is laid out
- The problem
- The simple version
- What stickiness does to the pool
- When affinity is fine, and what replaces it
- Algorithms
- Health and draining
- L4 vs L7
- Proxy, gateway, mesh
- Stickiness
- Check your understanding