...

/

Dealing with Stateful Communications

Dealing with Stateful Communications

Learn how to support stateful communications in applications using sharing and sticky load balancing.

The cluster module doesn’t work well with stateful communications where the application state isn’t shared between the various instances. This is because different requests belonging to the same stateful session may potentially be handled by a different instance of the application. This isn’t a problem limited only to the cluster module, but, in general, it applies to any kind of stateless, load-balancing algorithm. Consider, for example, the situation described in the illustration below.

Press + to interact
An example issue with a stateful application behind a load balancer
An example issue with a stateful application behind a load balancer

The user John initially sends a request to our application to authenticate himself, but the result of the operation is registered locally (for example, in memory), so only the instance of the application that receives the authentication request (Instance A) knows that John is successfully authenticated. When John ...