Remove Slow Startups And Enjoy Less “Suspense” Through .NET 4.5.1’s App Suspend Feature

It's always nice when you can just either install something or flip a switch and experience dramatic improvements within your application performance. This article covers one of those switches that you might be interested in flipping, the App Suspend feature, which is available in .NET 4.5.1 on Windows Server 2012 R2.

The newest iteration of the .NET Framework (4.5.1) has introduced all kinds of nifty features, one of which is the App Suspend feature, which can not only make your ASP.NET sites and web applications much more responsive, but it also enables you to host more sites on a single server without compromising performance.

This post will explain a bit of how the App Suspend feature works, how to implement it within your application and the kind of benefits that you should be able to expect from using it.

What is App Suspend? How does it work?

As mentioned, App Suspend was introduced within .NET 4.5.1 and is actually built on another fairly new .NET feature called the IIS Idle Worker Process Page-Out, which might sound like a mouthful, but is incredibly useful.

The IIS Idle Worker Process Page-Out option was introduced in IIS 8.5 and it allows IIS to suspend applications that may become idle rather than terminating them. This suspension will enable these applications to be very quickly restarted when requested as opposed to if they were terminated, which would require the server to spin up and essentially experience a cold start.

So when an application becomes idle, if the IIS Idle Worker Process Page-Out function is enabled, the application will remain active and will be paged out to disk rather than terminated and when it is requested in the future, the process will be re-activated and immediately available for use.

Application

You can see a very basic breakdown of how the App Suspend feature differs from the traditional idle time out operations.

The introduction of this feature will allow the presence of three different states of sites or applications within your server to be running:

  • Inactive Sites: Sites that are completely inactive. They are not loaded into memory currently and will need to be spun-up when requested. This is the default state that a site will be in prior to being accessed.
  • Active Sites: Sites that are currently running, being accessed and that have not idled out. They are actively using system resources such as memory and CPU cycles.
  • Suspended Sites: Sites that may have been previously running and have been paged-out into memory and suspended through App Suspend and are awaiting to be re-animated. Suspended sites receive far less CPU cycles and system memory, which can be allocated to other active sites that need it.

Depending on your server and its limitations (such as physical memory) can allow you to not only experience much quicker start-ups for your suspended sites, but it can also allow you to run more sites within your environment, as suspended sites take up a fraction of the memory that active ones do. This could result in awesome benefits for servers that currently host a large number of sites not only in resource management but in performance as well.

How to Enable App Suspend

Like with most settings and changes within IIS, the IIS Manager dialog can make finding specific configuration settings and using them quite easy. You can take the following steps to implement App Suspend within IIS:

  1. Open the IIS Manager (available through the Control Panel > Administrative Tools > Internet Information Services (IIS) Manager)

    Open the IIS Manager
  2. Click on the Application Pools that you want to target on the left.

    rion pc

  3. Right-click on the Application Pool that you want to enable App Suspend for on the right; Select the Advanced Settings option from the context menu.

    pools

  4. Find the Idle Time-Out Action property and set it to Suspend.

    Suspend

    For testing purposes, you can change your Idle Time-Out (minutes) property to a very short period to ensure that it is working properly. You can check the Event Viewer to see that the application was properly suspended.

What to Expect?

An analysis from the .NET team saw outstanding results through this simple change within their hosting environments, but the two major benefits boil down to the points below:

  • Dramatically Increased Start-up Times: You can reasonably expect up to a 90% drop in start-up times for your applications that are running with App Suspend.
  • Improved Hosting Density: Due to the way that suspended applications are stored, they use a fraction of the resources they normally would. This can allow you to increase the number of sites by up to 7 times that you could previously host without App Suspend.

    You might not experience exactly the same benefits (obviously if your hardware can’t support it, don’t risk trying to add 10x the number of sites you normally host), but you should certainly see faster start-up times across all of the sites that you are running within the targeted Application Pools.

Up Next
    Ebook Download
    View all
    Learn
    View all