We help IT Professionals succeed at work.

Session Timeout and Application Pools

Medium Priority
412 Views
Last Modified: 2012-05-12
I have an intranet site with about 180 users on it.

One IIS server with 4 webs...of which one web gets 95% of trafic.

Occassionally the web would get slower....and slower...and slower...and then stop
Did searches for open connections etc...all that was fine.

So I set the Application Pools to recycle every 2 hours from 8am - 6 pm with an hourly reset in the busiest part of the day...12 - 3pm.

NOW...It seems that I'm dumping sessions when its recycled.

What is the best solution...I have these folks doing data entry...walk away to a meeting and leave form open...come back...and everything dumps.

Any ideas?
Comment
Watch Question

Commented:
Rather than recycling it on a timed interval you should set it up to recycle if it hits a certain memory threshold, that should make it only recycle when needed.

Now what you should do is look into why the app pool is slowing down. Look at the code on the websites and see if there are any looping connections to the database where on each iteration a new connection is opened such as:

foreach(var something in somewhere)
{
    connection.Open();
// do something
    connection.Close()
}

Open in new window


In a case like this you're much better off to do:
connection.Open();

foreach(var something in somewhere)
{
// do something
}

connection.Close()

Open in new window


Also another problem area to look for that will use a ton of memory is string concatenation within a loop for instance:
string ret = "";
foreach(var something in somewhere)
{
     ret += something;
}

Open in new window


If you have anything like this you are much better off to use the string builder class
System.Text.StringBuilder ret = new System.Text.StringBuilder();

foreach(var something in somewhere)
{
    ret.Append(something);
}

Open in new window


Hopefully this points you in the right direction.
Larry Bristersr. Developer

Author

Commented:
Great!  Thanks

Explore More ContentExplore courses, solutions, and other research materials related to this topic.