user384080
user384080

Reputation: 4692

App Suspend IIS app pool .Net 4.5.1

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.

Upvotes: 7

Views: 4324

Answers (1)

Mani Gandham
Mani Gandham

Reputation: 8312

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

Upvotes: 12

Related Questions