Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Suspend IIS app pool .Net 4.5.1

Tags:

.net

iis

i just read a blog in msdn that .Net 4.5.1 introduces the new app pool setting App Suspend. In what circumstance you want to set your app pool to "Suspend" rather than "Terminate" or vice versa? if the "Suspend" idle mode is the much better setting than Terminate, then why not defaulting to Suspend and get rid of the "Terminate" idle mode.

like image 956
user384080 Avatar asked Nov 21 '13 11:11

user384080


People also ask

How do I disable app pool in IIS?

How to Stop Application Pools Using the IIS Manager. On the Connections pane, expand the server node and click Application Pools to display all Application Pools. On the Application Pools page, select the application pool for the published application that is running. Click Stop to stop the application pool.

What causes IIS app pool to stop?

This issue occurs when the IIS application pool Identity Parameter is not set to NetworkService. To resolve this issue, change the Identity parameter to NetworkService in the IIS Manager for Windows Server: Select the Advanced Settings for the DefaultAppPool.

How do I enable IIS application pool?

Go to Websites & Domains > Dedicated IIS Application Pool for Website. Select the “Enable 32-bit applications” checkbox and then click OK.

How do I automatically restart application pool in IIS?

Configuring Auto-Start with IIS Manager In the Connections pane, select the Application Pools node, revealing the Application Pools pane in the main view. Select the application pool for which you wish to enable Auto-Start. Locate the Start Mode option under the General group and set it to AlwaysRunning. Click OK.


1 Answers

IIS version 6 and above uses Application Pools to serve websites. Each App Pool is basically a separate worker process that will respond to requests for whatever websites you have in that App Pool. It helps to isolate different websites from each other (resource usage, errors, security breaches, etc).

Part of the way Application Pools are structured, they are by default "recycled" or restarted every so often to avoid application crashes or reset memory leaks.

There are three main ways that cause an App Pool to recycle:

  1. Interval-based (by default it's set to every 29 hours)
  2. Unresponsive (measured by IIS checking the app performance)
  3. Config changes (changing web.config or app pool settings)

Recycling isn't a big deal because IIS will create a new process and transfer requests before terminating the old process so there's no gap in serving requests. However, there is a setting for the App Pools that will terminate the process completely if there are no requests for a certain amount of time (default of 20 mins).

When the app pool shuts down and a new request comes in, then there's a noticeable lag of several seconds for the worker process to start, load the .NET frameworks, compile any pages in your app and finally serve the request. This is referred to as a "cold start" and can create a bad experience for your users.

You can disable both the recycle settings and the timeout-based terminate options if you want (and I do for several big applications) but if you are running lots of sites on a single server that don't get a lot of continuous traffic, you can conserve resources by using the new "Suspend" option.

Instead of completely terminating the process, IIS instead moves it to a very low-memory state. This way if a new request does come in, your app starts up instantly. There's no lag. But when there's no traffic, it uses just a tiny fraction of memory and no CPU so there's no overhead on your server.

It's really meant for shared environments with servers running lots of sites. If you have constant traffic you won't notice a difference since the App Pools never stop anyway but if you're sticking to the default settings then I highly recommend setting the App Pools to Suspend mode. Note that this requires both Windows Server 2012 R2 and .NET 4.5.1 to work.

Here's a Youtube video explaining it further from the Visual Studio team: https://www.youtube.com/watch?v=hXw5gyqTxoo

like image 54
Mani Gandham Avatar answered Feb 20 '23 18:02

Mani Gandham