Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Pool vs Application Domain Recycling in Asp.net?

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 ?

like image 626
Abolfazl Avatar asked Oct 24 '25 18:10

Abolfazl


1 Answers

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

  • What ASP.NET Programmers Should Know About Application Domains
  • IIS Application Domain and Pool Recycling
  • Application Pool Recycles from IIS 7 Setting Changes
  • What is the difference between Web Farm and Web Garden?
like image 129
Reza Aghaei Avatar answered Oct 26 '25 09:10

Reza Aghaei



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!