programming4us
programming4us
WEBSITE

IIS 7.0 : Managing Application Pools (part 1) - Application Pool Considerations, Adding a New Application Pool

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
7/7/2012 6:27:20 PM
Application pools facilitate hosting a group of Web applications inside a separate set of IIS worker processes that share the same configuration. Application pools enable you to isolate applications for better security, reliability, and availability. The worker process serves as the process boundary that separates each application pool so that when one worker process or application is having an issue, other applications or worker processes are not affected. For example, imagine you plan to install an old ASP application that uses legacy component objects. To protect other applications in the Web site, you can create a new application pool and host the legacy application inside the new application pool. In this example, if the legacy application fails, other applications will not be affected, because the legacy application is served by a different application pool.

Each application pool can have one or more worker processes serving the application pool. However, each worker process belongs to only one application pool.

Web Gardens

An application pool with more than one worker processes is known as a Web garden. Many worker processes serving the same application can sometimes provide better throughput performance and application response time. Take note that in a Web garden, each worker process has its own process threads and memory space. If the application uses in-process session variables, the application will not function correctly, because the same user requests are picked up by different worker processes that do not share the same session details. ASP.NET applications can overcome this issue by using out-of-process session management options, such as the session state service or SQL Server–based session state.

Web gardens are not recommended most of the time because they hurt performance except in very specific cases, such as the following:

  1. Your application makes long-running synchronous requests that significantly reduce concurrency.

  2. Your application is very unstable and crashes a lot, so having multiple processes helps maintain availability. (In this case, of course, the best approach is to fix the application.)

  3. Your application has process-wide resources that run low or uses process-wide locks that significantly reduce concurrency.

In most of these cases, redesigning your application to perform long-running tasks asynchronously, eliminating process-wide locking, and reducing crashes is a better long-term approach than relying on Web gardens.

Application Pool Considerations

By default, there are two predefined application pools when IIS 7.0 is installed. As shown in Table 1, there are two application pools with different worker process models. The Web Server (IIS) role setup creates the DefaultAppPool application pool and is the default application pool for new applications. The ASP.NET role service setup creates the Classic .NET AppPool to enable ASP.NET applications to run with the Classic ASP.NET Integration mode. You can configure applications to run in these default application pools, or you can create a new application pool.

Table 1. Predefined Application Pools

Application Pool

.NET Framework

Managed Pipeline

Identity

Classic .NET AppPool

Version 2.0

Classic

NetworkService

DefaultAppPool

Version 2.0

Integrated

NetworkService

Note

The Classic .NET AppPool application pool is created during ASP.NET 2.0 setup. The installation of the .NET Framework 1.1 calls the aspnet_regiis.exe tool to install ASP.NET 1.1, which creates the ASP.NET 1.1 application pool.

Neither application pool is created by default when IIS 7.0 is installed.


Before you create a new application pool, you need to consider—from many perspectives—if such an application pool is needed. Because a dedicated worker process fulfills each application pool, the more application pools, the more worker processes may be running on the system to handle requests to the applications on the server. This could impact overall system performance, because each worker process consumes system resources such as processor time and memory. Even so, for most administrators, maintaining separate application pools for different applications will never cause any problems.

Note

For reliability reasons, you should by default use separate application pools try to host each application (and Web site). Doing so can also allow you to take advantage of least privilege by granting the minimal set of permissions to each application pool identity, helping isolate the application from each other.


Capacity Analysis for Large Numbers of Application Pools

No fixed formula exists to determine the maximum number of worker processes that can run on a server. Similar to figuring out the maximum number of Web sites that can be hosted in IIS 7.0, you must perform capacity analysis to evaluate the overall system performance when a large number of worker processes will be run on the system. The analysis should look at the memory footprint of the application under heavy loading, the impact of recycling, the number of concurrent requests per application, and so on. Performance load testing will help with this analysis. You can use Microsoft Visual Studio Team Edition as well as the Web Capacity Analysis Tool (WCAT) to assist with these evaluations. As a Web administrator, you must evaluate the importance of having dedicated application pools and then find an appropriate balance between application isolation and performance throughput for your Web server. 

Consider the following factors before creating new application pools:

  • Security. You can create a new application pool and configure a custom application pool identity with access rights when the application requires custom access to certain resources. A custom application that updates system configuration is an example of such a situation. As another example, consider applications that belong to two different customers and for which content access must be absolutely restricted to each respective customer.

  • Reliability. You can create a new application pool to isolate unstable or new applications. For example, you can isolate a legacy component application that crashes from time to time, or separate the new integration applications that are still in testing phase. Isolating these applications increases the reliability of other applications as failures in the legacy or testing applications will not affect other applications.

  • CustomizationYou can create a new application pool when an application requires different application pool settings. Such a situation arises if you have an old application that must run in the Classic process model, and others must run in Integrated mode.  In IIS 7.0, the ASP.NET Integration mode and .NET Framework version are configurable at the application pool level. In addition, creating a new application pool allows you to configure a unique set of worker process settings (such as the application pool recycling interval or queue size) that are different from the common application pool. You might also want to isolate an application based on application types. For example, you might want different application pools for ASP and ASP.NET.

Note

Although IIS 7.0 supports side-by-side execution of applications using different versions of the .NET Framework, you should understand that different .NET Framework applications require different application pools because each application pool is assigned to only one .NET Framework run-time version.

Adding a New Application Pool

To use IIS Manager to create a new application pool, expand the IIS computer node in the Connections pane and navigate to the Application Pools node. Right-click the Application Pools node and select Add Application Pool. Alternatively, click Add Application Pool in the Actions pane. The result is shown in Figure 1.

Adding a new application pool by using IIS Manager.

Figure 1. Adding a new application pool by using IIS Manager.

Note

When using IIS Manager to add an application pool, select the Start Application Pool Immediately check box if you want to start the application pool right after creating it.

When an application picks up a request from an application pool which is not running, IIS 7.0 returns a 503 HTTP "The service is unavailable" error to the client browser.

After you have created an application pool, you can either create a new application to run in the new application pool or assign the new application pool to an existing application. To assign an application pool to an existing application by using IIS Manager, expand the IIS computer node in the Connections pane and then expand the Site node in the tree listing. Navigate to the desired application and then click Basic Settings in the Actions pane. Click the Select button to choose the new application pool from the list of available application pools, as shown in Figure 2.

Assigning an application pool to an existing application by using IIS Manager.

Figure 2. Assigning an application pool to an existing application by using IIS Manager.

Caution

Assigning a new application pool to or changing the application pool for an application that is running may end up loading the application in the new worker processes for the newly assigned application pool, but application details or variables in the old worker process are not visible to the new worker process. The application will continue processing existing requests in the old worker process but will not receive any additional requests after the changes are applied and are detected by the original worker process.

Use the following Appcmd syntax to create a new application pool.

appcmd add apppool /name:string /managedPipelineMode:enum /managedRuntimeVersion:string

To set the properties on an existing application pool, use this syntax.

appcmd set apppool ApppoolName /managedPipelineMode:enum /managedRuntimeVersion:string

Table 2 describes the parameters for ADD APPPOOL or SET APPPOOL syntaxes.

Table 2. Syntax for Appcmd to Configure Application Pool Properties

Parameter

Description

name

The name of the new application pool. Required to add an application pool.

AppPoolName

The application pool name. Required when editing an existing application pool.

managedRuntimeVersion

Specifies the .NET run-time version for the application pool. Can be "v1.1", "v2.0", or "" for no Common Language Runtime (CLR). Future versions of the .NET Framework will support new versions strings. The default is "v2.0".

managedPipelineMode

The ASP.NET integration mode for the application pool. Values are "Classic" or "Integrated". Default is "Integrated".

The following command creates a new application pool with the name "Fabrikam Stock".

appcmd add apppool /name:"Fabrikam Stock"

The output, shown in the following syntax, indicates a new application pool object has been added to the configuration store.

APPPOOL object "Fabrikam Stock" added

To change the new application pool’s basic settings, such as the process model and the .NET run-time version, use the SET command. The following command reconfigures the newly created "Fabrikam Stock" application pool to run on .NET run-time version 1.1 and changes the process model to Classic ISAPI mode.

appcmd set apppool /apppool.name:"FabrikamStock"
/managedRuntimeVersion:"v1.1" /managedPipelineMode:"Classic"

Note

To enable support for .NET Framework version 1.1, you need to install the .NET Framework 1.1. By design, when it is installed, a new application pool named as ASP.NET 1.1 is created. This new application pool is configured to run in the Classic worker process model with the .NET Framework 1.1 run time. 

Finally, when the new application pool is ready, you can either create a new application to run on the application pool or assign the application pool to any existing application. For example, the following syntax configures the existing "Stock" application to run in the "Fabrikam Stock" application pool.

appcmd set app "Fabrikam HR/Stock"
/applicationPool:"Fabrikam Stock"

Caution

When using Appcmd to set the application pool for an application, the command line tool does not verify if the specified application pool exists in the configuration system. If the application pool does not exist, the application will fail to load at run time.

When adding a new application pool, the configuration system creates a new application pool element under the <applicationPools> section in the applicationHost.config file. The element includes the name of the application pool, the worker process model, and the process identity if it is different from the default settings. The following shows the <applicationPools> configuration of the newly created Fabrikam Stock application pool in .NET Framework version 1.1 run time.

<applicationPools>
    <add name="DefaultAppPool" />
<add name="Classic .NET AppPool" managedPipelineMode="Classic" />
<add name="ASP.NET 1.1" managedRuntimeVersion="V1.1"
    managedPipelineMode="Classic" />
    <add name="Fabrikam Stock" managedRuntimeVersion="V1.1"
        managedPipelineMode="Classic" />
    <applicationPoolDefaults>
        <processModel identityType="NetworkService" />
    </applicationPoolDefaults>
</applicationPools>

When you assign a new application pool to an existing application, the <application> element inside <site> element is updated by IIS Web core. 

Other  
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
REVIEW
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
programming4us
 
 
programming4us