views:

486

answers:

4

We have an ASP.Net 2.0 web application running in a web farm which is using the ASP.Net State service to store sessions.

We have been having problmes with the service intermittently and have changed a few things such as the machineKey in the machine.config.

My actual question is around the monitoring of the state service service. We have all 4 available performance counters running on the server that hosts the service and as yet we have not seen a single session time out. We have also seen the number of active sessions slowly rise over a period of time, but never become less.

Does the state service recognise when sessions time out? Is there something we should be doing manually?

Edit: We have given up on the state service and gone with SQL server sessions.

To answer the questions below, it seems that sessions go up forever until the service falls over and it is very doubtful that any oen threads are linked to the state server. This is a fairly basic web app at the end of the day.

It seems from the reading I am doing that anumber of other people have experienced similar things, but there seems to be a general lack of common sense and knowledge in any responses flying about.

MS seem to have almost no documentation on this topic.

+1  A: 

In ASP.Net session time outs can be configured in web.config and machine.config. The default time out assuming nothing has changed will be 20 mins. The machine.config file can be set to not allow overriding, which means that any changes specified in web.config files will not override these settings.

Have you ensured that the appropriate settings are in place in both machine and web config files?

The state service should drop each session after 20 mins of inactivity assuming the default settings.

At what point are your inactive sessions dropped? I assume they are not exponentially increasing, unless your are restarting the service in order to clear them they must be being dropped at some point.

Charlie
After a few hours of monitoring I finally have one session that was abandoned, but that accounts for some code which specifically does that.The Inactive sessions do not appear to be dropped at all
Blatfrig
A: 

Do you have something that might be hitting the session and keeping it alive without you knowing? Is there are thread being spawned somehwere that is doing work inteh background and holding on to your session? As far as my expeireince goes the timeout is set int he web config file and it just doesn't it's magic from there.

Middletone
A: 

In my experience we've found out that native state server or even using SQL Server for sessions is a very scary scenario as both have issues.

I think you can explore other products for this to achive the absolute best. A free option would be Velocity but it is still not released.
And another comprehensive but proven product will be (Very expensive actually) NCache

Take a look and see which looks best for you.

About SQL Server, you server will die very soon if you have enough number of hits coming in (I belive you have some hits already which yielded you to do Web Farm or you do it just for the sake of redundancy)

SevDer
A: 

I am sure this will get modded down, but I have to say it.

If you are having issues with the state server, then there is likely an error somewhere in your web application. Charles' comment above seems like good places to start checking, but somewhere there is a life cycle issue.

Go back over the code and check your assumptions. Take a new computer, visit your website (create a session) and let it sit for an hour. If your session is still alive, then something is wrong. Create a new web application that just has a single page reporting the the age of the current session and try the same thing. You should find that after an hour (default is 20 minutes) the session is no longer valid. Now you have a system that is working as expect and one that is not, both using the same session server, so you can rule that out as the problem, now start going through code/configuration and see where you could be keeping it alive (or preventing the time-out).

Here, by the way, is a 'valid' session config. If you don't have your looking something like this, you have likely found your issue:

<sessionState 
   mode="StateServer" 
   stateConnectionString="tcpip=10.1.1.1:55455" 
   cookieless="false" 
   timeout="20" />

Also make sure you are not overriding your web.config with your machine.config to have a longer timeout.

JasonRShaver