Web / Traefik Interview questions
Why would you use sticky sessions in Traefik?
Sticky sessions bind a client to the same backend instance across multiple requests, using a cookie the load balancer sets and reads, instead of letting round robin send each request to a different instance.
They matter for applications that keep state in the process serving the request, such as in-memory session data or WebSocket connections, where routing a follow-up request to a different instance would mean losing that state or breaking the connection.
http: services: myapp: loadBalancer: sticky: cookie: name: traefik_session
The trade-off is that sticky sessions reduce load-balancing effectiveness, since one instance can end up overloaded with "stuck" clients while others sit idle, so stateless designs with an external session store are usually preferred when possible.
More Related questions...