Session Management using Affinity

Many a times on a Web load balancer, developers argue whether to use InProc or Out of Process session management.  The way to acheive InProc session management is by using Affinity. What it means is once a user request hits a web server, all the subsequent requests must be directed to the same web server, other the session will be lost. These are also called sticky sessions. Some pros and cons of this approach.

Cons:

1. If the asp .net worker process recycles all the sessions are lost
2. When you need to upgrade you need to wait all the users from a particular server to finish their job or else need to kill their sessions, they cant automatically be transferred to other sessions

1. If the asp .net worker process recycles all the sessions are lost

2. When you need to upgrade you need to wait all the users from a particular server to finish their job or else need to kill their sessions, they cant automatically be transferred to other sessions

Pros:
1. Keeping sessions in memory is fast
2. Simple and all the load balancing solutions supports it
3. Out of process requires coding effort as all the classes that are kept in session need to be marked serializable

Getting rid of affinity is called Distribution or Out of Process.

Leave a Reply