3

I'm a bit confused about the effects of recycling application pool and application Domain. as i red an high voted article as follows: What exactly is Appdomain recycling

It says that appdomain recycling is caused by any changes in settings or bin folder but as you can see below

enter image description here

Application pool is also recycled by configuration changes in a website that use this application pool, at this point three questions come to my mind

1.Firstly,is it reasonable to recycle application pool for any configuration changes made in website1 that also will affects website2 hence both of them use the same application pool?,Then what happens to isolation boundary between multiple applications that use the same application pool?

2.Secondly,What is exactly difference between AppPlool recycling and AppDoman Recyclyng?,Because both of them seems to do the same thing at the time of recycling?

3.Based on the picture above,Can we come to this conclusion that configuration changes will recycle AppDomain for sure but not necessarily AppPool ?

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Abolfazl
  • 1,592
  • 11
  • 32
  • [IIS Application Domain and Pool Recycling](https://www.treeloop.com/blog/iis-application-domain-and-pool-recycling) – Reza Aghaei Feb 11 '20 at 16:30

1 Answers1

4

Your questions

  1. Application config changes will not restart Application Pool. Configuration changes restart AppDomain and each App has a different AppDomain which takes care of boundary and isolation.

  2. AppDomain Recycle is unloading and then reloading the AppDomain from w3wp process and doesn't restart the process. But Application Pool Recycle is unloading the corresponding w3wp process(es) of the Application Pool.

  3. Yes, application config changes will recycle AppDomain, not the Application Pool.

Application Pool Recycle vs AppDomain Recycle

I believe this summary (based on the links at bottom of the post) will help you to get a better understanding of Application Pool Recycle and AppDomain Recycle.

AppDomain Recycle

There are cases where an application domain must be unloaded from memory, reloaded, and the code re-jitted. This process does not terminate the worker process (w3wp.exe) and therefore does not affect other application domains assigned to the same pool.

Application Pool Recycle

An application pool recycle is when the all of the worker processes (w3wp.exe) for an application pool are unloaded and new instances are started to serve incoming requests.

AppDomain Recycle Circumstances

The following circumstances will cause a recycle of an application domain:

  • Modification to web.config or Global.asax
  • Change to the contents of the application's bin directory
  • Change to the physical path of the virtual directory
  • Deletion of the subdirectory of the application
  • The number of re-compilations (aspx, ascx or asax) exceeds the limit specified by the <compilation numRecompilesBeforeAppRestart=/> setting in machine.config or web.config (default of 15)

Application Pool Recycle Circumstances

Circumstances that can cause an application pool recycle to occur:

  • Configuring a recycling condition for the pool

    ○ Regular time interval (default of 1740 minutes)
    ○ Fixed number of requests
    ○ Specific time
    ○ Virtual memory usage
    ○ Private memory usage

  • Having a idle time-out value set for the pool (default of 20 minutes)
  • Making a configuration change in IIS that causes a recycle

More information

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
  • Thanks for your comprehensive answer,i think this sentence you wrote that 'An application pool recycle is when the all of the worker processes (w3wp.exe) for an application pool are unloaded' could not be regarded a true concept,because each application pool has its own single w3wp.exe process not multiple worker process – Abolfazl Feb 11 '20 at 17:06
  • Each application pool by default have a single worker process, but may own more than one as well. It's what called a web garden. – Reza Aghaei Feb 11 '20 at 17:07
  • oh yes...you meant 'Maximum Worker Processes' in IIS Configurations. – Abolfazl Feb 11 '20 at 17:09
  • Yes, I added another link to the answer which is talking about Web Garden. – Reza Aghaei Feb 11 '20 at 17:14
  • The summary that I've shared in the answer is taken from first link, however I've already read rest of the links as well and I may add a few more point to the summary from other articles as well; however I prefer to keep the post as short as I can while informative. – Reza Aghaei Feb 11 '20 at 17:16
  • I appreciate the time you allocated to answer this question. – Abolfazl Feb 11 '20 at 17:26
  • I see you have assigned the bounty but unaccepted the answer, let me know if you have any concern about the answer. – Reza Aghaei Feb 12 '20 at 16:36