Koen about .Net

July 14, 2009

Problems with session time-outs & Load balancing

Filed under: Development, Release management — Tags: , — koenwillemse @ 13:00

When we went live with our last big project, we got a lot of complaints about users getting logged out way too fast. They indicated that this occurred within a few minutes. We absolutely didn’t understand this as we configured the session timeout to be 20 minutes.

 

We googled a lot and found a lot of posts concerning settings in IIS. We checked those, made some modifications and thought the problem would be fixed. But of course… Not :-(. We double checked the settings, and again and again… A lot of googling time later we found a post (I forgot the url) about session timeouts and load balancers. And then we finally found it.

 

The problem is that the production environment uses a load balancer for our two front-end servers. Because we use in process session state the network guys configured the balancer to use sticky sessions. We thought that it would work OK then. But then we got to the problem using the earlier mentioned post. Load balancers also use a sliding timeout on the stickyness of the session! We checked this with the network guys and what was the surprise: default value of this timeout was 5 minutes! So we updated this to 30 minutes and it worked fine again :-). Finally, after a lot of hours googling, checking settings, double checking them etc, we found the problem.

 

What are the lessons learning?

1. Make sure that when a load balancer is used and you use in process session, that the expiration of the sticky session has a correct timeout set.

2. Make sure that you staging area has the same network topology as your production servers. We didn’t have this (now we do!), otherwise we would have run into the issue way earlier and our users would have been less annoyed ;-).

Create a free website or blog at WordPress.com.

%d bloggers like this: