App Pool Recycling.... affect on current Users??

Hi,

I need to schedule an "App Pool" recycle for about 5pm due to memory leak which I am sorting, but obviously will take a little time.

Now my understanding is that the recyling of Application Pools is intelligent and does not disturb current users. Is this correct?  In the past I have resaved the "Web.config" which resets the ASP.NET Worker Process for the website which obviously does kick people out. I hasten to add I have done this late at night !! However it releases lost memory that my website has taken up, but obviously not memory lost by other websites on the same server.

So can I use App Pool Recylcing during the day without effect to the end users. If so then would there be any initial ASP.NET page delay after a recycle?

Thanks,

Sam
SamJollyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alfred A.Commented:
Hi,

What kind of session management do you use?  Are you using the default InProc process?

You can try using either State Server or SQL Server session management to separate the ASP.NET worker process from the Sessions.  This means that if an App Pool recycles, session would be intact because it is in a separate thread.
0
SamJollyAuthor Commented:
Hi Alfred.... I am using standard session management. So are you saying that I will destroy all the current sessions with app recycling?

Sam
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

SamJollyAuthor Commented:
Alfred,

I think this says it all !!

Thanks,

Sam
0
SamJollyAuthor Commented:
Out of interest... do you have views on any how many CMS sites should be a W2K3 server which also has SQL Server on it. There is 4GB of RAM on this 32bit Server. Just wondering whether the Server is being overworked....???

My available memory can start at 350MB in the morning and go down to about 1MB at midnight? Other sites eat into this as well.However if I do a web.config reset then I can get back from 1MB to about 190MB. So there is obviously a leak of sorts somewhere which I am checking with a profiler, but am wondering whether it is reasonable to be operating with these numbers in a live system. The test server is at around 900MB !!

Cheers,

Sam
0
Alfred A.Commented:
Hi Sam,

No problem.  Happy to help. :-)

0
Alfred A.Commented:
Hi Sam,

OK.  It really depends on concurrency.  How many users hit your servers at the same time?  Every user uses resources.  The higher the number of users, the higher the memory consumption.

Also, the w3wp.exe I believe has a limit of 1GB in W2K3, you might end up getting an out-of-memory error because of this.

Also, one thing that can lower down memory leaks is to handle all exception thrown.  Unhandled Errors waste resources and they stay in memory for quite sometime before being cleaned up.

Also, try to dispose your objects as soon as you don't need them.  Don't just let the GCC finalizer do this for you.

I hope this helps.

0
SamJollyAuthor Commented:
Alfred,

Thanks for this.

Interesting comment about Unhandled Exceptions. Basically I have taken on a webapp and it uses the OnError event in Global.asax to handle Unhandled Exceptions, write them to a DB Error Log and then clears them using "Server.ClearError()". Now I have to admit that I am getting quite a few errors although they are not affecting the User Experience... well that is until there is an out of memory error!! Of particular note are quite a few "invalid viewstate" errors.

I had always thought that the GC goes around pretty quickly clearing up. At least after 15 mins one should expect a clean down of junk....????

For info my profiler tells me that my memory usage on my current session is 61MB (dev server) . Now how much of this is overhead that would not be repeated by a 2nd user I am unsure since the profiler can only map to one user session.

I know we are getting a little off track, but I value your thoughts.....

Thanks again,

Sam
0
Alfred A.Commented:
Hi,

-> Now I have to admit that I am getting quite a few errors although they are not affecting the User Experience...

Your comment above is the tricky part.  I got burned in the past because of that.  A simple try-catch would do you a lot of good. :-)

Normally, for the overhead, it really depends on the type of web site you are doing, if it is a web application that deals with heavy custom objects, a user will use more resources especially if you are using viewstate and sessions heavily.  As long as what the user uses (instantiates), returns later (dispose) after the process is over, the memory usage is usually really small.

In a web application that I did in the past, at peak, it reaches 950 MB for about approx 3000 users.  After handling the errors properly, it was peaking around 300 MB.  Big difference.
0
b_levittCommented:
Alfred answered your original recycling q so he deserves the points but I thought I'd jump in:

32 bit IIS has the same limits as other 32 bit processes - 2g or 3g with the /3g switch.

If your server shows free physical memory but you are still getting out of memory errors, then you might be bumping into a virtual memory problem or the memory fragmentation issue with 32 bit machines:
http://blogs.msdn.com/david.wang/archive/2006/02/14/More-on-Virtual-Memory-Memory-Fragmentation-and-Leaks-and-WOW64.aspx

I certainly agree that expected errors should be caught with a SPECIFIC catch, but I'm of the school that beleives catch(System.Exception) is generally a bad idea.  I don't think there is anything wrong with your global.asax routine.  Instead I would try to resolve the unhandled errors rather than change the way you're handling them.  

Ironically, invalid viewstate can be caused by a recycling app pool.  Your app pool might already be recycling if you have mem/virtual mem limits already set on the app pool.
0
SamJollyAuthor Commented:
Alfred,

How did you get those stats... ie using 950mb for 3000 users...??? Would be very interested in these stats for my site.

All I seem to be able to do is to find out what memory is available using a utility that I wrote using MemoryFailPoint.

I fear that going through the app and adding in Try Catch blocks etc will take a little while so I am thinking that there is wisdom in altering the session model to State or SQL Server so at Ieast I can app recycle. My current mod was to put in "MemoryFailPoint", but of course this just protects the server and does not recover memory. Then start altering code over a period of time.

Unfortunately there is little that can be done with the server without upgrading to 64bit, moving apps around etc....

Just hope State or SQL Server Session mgt does not throw up extra issues....

Sam
0
b_levittCommented:
As far as mem usage I've, seen sharepoint servers hover at 3g and higher on 64 bit machines.  900 isn't all that much but is pretty high.  Try browsing the site page by page and see where mem goes up.  There might be some places where objects are being dumped to session state and then not cleaned up.

Use of output caching (which actually will use memory) might reduce your overall usage beleive it or not.   Its very likely that the rendered page text takes less memory than the object did to create it.  You just have to be carefull about what you cache.

Good luck
0
Alfred A.Commented:
@b_levitt,

Just to be clear, I use global.asax events such as Application_Error and Session_Error to catch errors but there were cases where specific errors considered unhandled and recorded in the Application Event Log of the production server I was working before and caused memory leaks within the application and I have plug the leaking pipe somehow.

I was just ask for my thoughts and all I can say is to each his own experience, mate!

I was not telling SamJolly to change his process.
 
0
Alfred A.Commented:
Hi Sam,

The only issue I had with State Server is that it is slower than InProc due to out-of-process communication between the worker threads and session threads.

Anyway, goodluck with your projects/tasks.

0
b_levittCommented:
I understand alfred, I just didn't want him making huge try/catch(System.Exception) blocks - It's my #1 programming sin :).

Sam,
You can't use task manager to view the memory usage?

You could look at the "Sessions Active" counter in perfmon to get a rough idea of "user" count
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/2d7927e4-4416-4439-900f-5fb64ab2ee58.mspx?mfr=true
0
Alfred A.Commented:
@b_levitt:

No worries.  I fully understand your position.   Anyway, I was just emphasizing to Sam the importance of handling errors whether it be global.asax routines or try-catch.

Cheers,
0
SamJollyAuthor Commented:
Thanks to both of you for your great help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.