asp.net-mvciisapplication-poolworker-process

Application Pool Start Mode: OnDemand vs AlwaysRunning, which the best?


I have always been using OnDemand start mode for my application pools but I have recently heard about AlwaysRunning mode which allows an ASP.NET application deployed to IIS to be available immediately after deployment. It seems like enabling this feature causes IIS to prime an application as soon as it is deployed removing the warm-up time often required of “cold hits” to a website. This is explained in this great article.

Below some doubts I have and I would like to understand:

  1. Using AlwaysRunning feature, what happens when recycling the application pool? memory used is removed and freed? Worker processes are terminated and started again or they continue available in memory and their memory used is not removed and freed?

  2. What are the advantages and disadvantges for OnDemand and AlwaysRunning? Which is better for a single worker process and which better for web garden (multiple worker processes)?

  3. Also, could someone explain how web site behaves when using AlwaysRunnig in combination with process idle timeout and idle time-out action and recycling? and the same for OnDemand. I would like to be clear about how all these pieces intervene together under these scenarios (AlwaysRunning and OnDemand).


Solution

  • 1)when you set the application pool always running on recycling it will remove the running worker process and again start it.

    2)as the definition stated if you set always running IIS Launches the worker process for the application pool as soon as IIS is started OR when the application pool is created.

    OnDemand-> IIS will launch the worker process when the first request for a Web application is received.

    the advantage of always running is user no need to wait after requesting resources. and the disadvantage of OnDemand there is a delay while the w3wp starts. the disadvantage of always running is memory is ways occupied for the particular worker process.

    in my opinion, for a web garden environment setting always running is a better idea.

    3)Suspending is just freezes the process and it is much more efficient than destroying the process. By default, IIS sets application pools to “time-out” after 20 minutes of inactivity. So if you don’t have any visitors to your site within 20 minutes, the application pool will shut down – freeing up those system resources. Then the next time a request comes into the site IIS will automatically restart the application pool and serve up the requested pages.

    if you want that your still will always set in always running mode and never sleep then the below setting is suitable for you: