Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How often should we recycle application pool?

How often should we recycle application pool ?

Someone told me that I should recycle the application pool every 24 hours ?

Why do I need to recycle the application pool ?

What kinds of benefits will we get?

like image 597
kevin Avatar asked Aug 15 '12 06:08

kevin


People also ask

How often should application Pool recycle?

By default, IIS configures your application pool to recycle after 29 hours of uptime.

Why do application pool needs to be recycled?

Recycling means that the worker process that handles requests for that application pool is terminated and a new one is started. This is generally done to avoid unstable states that can lead to application crashes, hangs, or memory leaks.

How long does it take to recycle application pool?

This could mean up to a minute and 30 seconds of downtime from each application pool. Not to mention, that all other application pools will need to come up again after the restart.


1 Answers

Unless there is some overriding reason, I would suggest not having any TIME based recycling (that is, no schedule such as at 3AM every day, nor a cyclic every 29 hour type recycle). I would argue this is more of a holdover from when things were less stable (consider a recycle the lighter version of having to reboot your servers on a routine basis).

In order to protect yourself against memory leaks and the like you can set limits on the Virtual and Used memory to force recycles should a process get out of control. You get all the value of ensuring you don't use up too much memory, without recycling unnecessarily.

There are absolutely times you need to recycle, but these mostly exist around changes (i.e. if you're dropping new DLLs in, or making certain configuration changes). In terms of just a "regular maintenance" type recycle, with properly written and tested code, this should not be necessary. (Additional caveat, proper monitoring helps too, since I suppose you could also have a process run away with CPU, and that doesn't have a recycle limit)

The benefits of a recycle is that you "start fresh". You clean out your memory and re-load your DLLs. Any long-running thread (read: hung thread that isn't doing anything) would get cleaned out. The disadvantage is that you have to take the time to load things back into memory (although the new warm-up stuff takes care of a lot of that for you).

like image 57
Stephen S. Avatar answered Oct 27 '22 01:10

Stephen S.