What Are Sticky Sessions?
Sticky sessions (also called session affinity) tell a load balancer to route every request from a specific client to the same backend server for the duration of a session. The load balancer typically tracks affinity using a cookie it injects (e.g., AWSALB, JSESSIONID) or by hashing the client's IP address.
Without stickiness, a stateless load balancer distributes requests across the pool using round-robin, least-connections, or a similar algorithm — with no memory of where a client went before.
When You Actually Need Them
Server-side session state
The most legitimate reason to use sticky sessions is when your application stores session data in process memory or on the local filesystem. If request #1 writes a shopping cart to /tmp/session_abc on Server A, request #2 must also land on Server A or it won't find that data.
This is common in:
- Legacy PHP apps using default file-based sessions
- Java EE apps with in-memory
HttpSessionobjects - Stateful WebSocket connections where the socket is held open on one server
- Upload workflows where a large file is being written incrementally to local disk
Expensive local caches
Some workloads build a warm in-memory cache (a compiled ML model, a parsed config, a hot database result set) that takes several seconds to rebuild. Pinning clients to the same node keeps that cache hot and avoids repeated cold-start latency.
When Sticky Sessions Hurt
Uneven load distribution
IP-hash stickiness is particularly prone to hotspots. If a corporate proxy funnels thousands of users through one IP, they all land on one server. Cookie-based stickiness is more granular but still creates imbalance when session lifetimes vary widely.
Reduced fault tolerance
This is the critical one. When a sticky backend goes down, every session pinned to it is interrupted. A clean round-robin setup degrades gracefully — users are redistributed automatically. With stickiness, those users see errors until the load balancer detects the failure and re-pins them.
The longer your health-check interval, the longer that gap. If you're relying on sticky sessions for availability, you need aggressive health checks — both at the load balancer layer and from an external monitoring service. Checking from a single vantage point isn't enough; a server might be reachable from your internal network but unreachable from a region your users are actually in. Multi-region uptime checks (like those Pingy runs) catch that class of failure faster.
Complicates deployments
Rolling deployments get messier. If you drain Server A for a new deploy, all its sticky sessions need to be re-homed. Some load balancers handle this with a drain/quiesce period; others just drop connections. Either way, it's an extra failure mode you have to plan for.
Masks stateful anti-patterns
If your team adds sticky sessions to paper over a stateful design, the underlying problem doesn't go away — it just hides until you try to scale horizontally or recover from a crash.
The Better Alternative: Externalize Session State
For most modern applications, the right fix is to move session data out of the server process entirely:
- Use a shared session store — Redis or Memcached are the standard choices. Every server can read and write session data, so any node can serve any request.
- Use signed stateless tokens — JWTs or similar structures carry the session data in the token itself. The server validates the signature and trusts the payload. No shared store needed.
- Use a distributed cache — For warmed computation caches, tools like Redis Cluster or a CDN edge cache let you share hot data across the pool.
Once session state lives outside individual servers, you can remove stickiness entirely. Your load balancer becomes truly stateless, deployments are cleaner, and any backend can absorb traffic when another fails.
Checklist: Should You Use Sticky Sessions?
- Is session state genuinely local to the server process, with no practical way to externalize it right now?
- Have you accepted the trade-off that a single-node failure will interrupt all sessions pinned to it?
- Are your load balancer health checks tuned aggressively enough to detect failures in seconds, not minutes?
- Do you have a plan to re-pin sessions during rolling deployments?
- Is this a temporary fix while you migrate to an external session store?
If you can't check most of these boxes, sticky sessions are probably adding risk, not reducing it.
Key Takeaways
- Sticky sessions are a workaround for server-side state, not a feature to reach for by default.
- They trade load distribution and fault tolerance for session locality.
- A single-node failure takes down every session pinned to that node — health check aggressiveness matters.
- Externalizing session state to Redis or using stateless tokens removes the need for stickiness entirely.
- If you do use them, monitor your backends from multiple external vantage points so you catch failures before your users do.