Using WSRM to manage IIS 7 AppPool CPU Utilization

by Walter Oliver

In the past administrators used CPULimit Metabase Property in IIS to configure the maximum percentage of CPU time that the worker processes in an application pool are allowed to consume over a period of time. With the availability of Windows System Resource Manager (WSRM), setting CPULimit is no longer needed, moreover, it is not recommended.

WSRM enables administrators to control how CPU and memory resources are allocated to applications, services, and processes. Managing resources in this way improves system performance and reduces the chance that applications, services, or processes will interfere with the rest of the system. It also creates a more consistent and predictable experience for users of applications and services running on the computer.

WSRM integrates resource management with Web pools through a built-in policy called Equal_Per_IISAppPool. Policies in WSRM automatically switch to different resource allocations in response hardware to hot-add changes or cluster changes if running in a cluster configuration.

Turning Off the CPULimit Metabase Property

  1. Start the IIS Manager and connect to the target server

  2. Click on the Application Pools node to view the available application pools, for each application pool open the Advanced Settings dialog by clicking Advanced Settings in the Actions panel.

    Screenshot of the Default App Pool node selected. Advanced Settings is emphasized in the Edit Application Pool section of the Actions pane.

  3. Under the CPU section ensure that the CPU Limit property is set to 0 (default value).

    Screenshot of the C P U limit set to 0 in the Advanced Settings dialog.

Using the Built-in IIS Policy

  1. After installing the Web Role proceed to install Windows System Resource Manager.

  2. Start WSRM by clicking the Windows Start button, select "Administrative Tool", and select "Windows System Resource Manager".

    Screenshot of the Windows System Resource Manager in the Administrative Tool.

  3. Start the Equal_Per_IISAppPool built-in policy.

    a. Open the Resource Allocation Policies node in the left-hand pane

    Screenshot of the W S R M dialog with Equal underscore Per underscore I I S App Pool selected in the Resource Allocation Policies. b. Right click on Equal_Per_IISAppPool in the left-hand pane c. Select Set as Managing Policy d. If prompted to disable the calendar, click OK

    Screenshot of the warning message that displays before disabling the calendar. e. Observe the behavior of the system under an IIS load. You could use WCAT for simulating a load on the server. This tools is part of IIS 6.0 Resource Kit which can be downloaded from the following link:

Creating a Custom IIS Policy (Optional)

  1. Create at least 2 process matching criteria (PMC) for different AppPools:

    1. Right-click on the Process Matching Criteria node in the left-hand pane.

    2. Select New Process Matching Criteria.

    3. The New Process Matching Criteria dialog appears.

      Screenshot of the New Process Matching Criteria dialog with Criteria name set as My P M C.

    4. Enter a name for the PMC and click Add.

    5. The Add Rule dialog appears

    6. Select the Files or Command Lines tab

    7. Click in the area labeled "Included files or command lines" and type in a matching criteria.

    8. Use the following format: @w3wp.exe.*<AppPoolName>

      Screenshot of the Add Rule dialog with at sign w 3 w dot e x e dot asterisk My App Pool included in the Files or Command Lines tab.

    9. Add lines to match additional AppPools (or any other processes) to this PMC.

    10. Click OK.

    11. Repeat the above steps for each additional PMC.

  2. Create a resource allocation policy (RAP):

    1. Right click on the Resource Allocation Policy node in the left-hand pane.

    2. Select New Resource Allocation Policy.

    3. The New Resource Allocation Policy dialog appears.

    4. Enter a name for the RAP.

      Screenshot of the New Resource Allocation Policy dialog with a Policy name of NEW R A P.

    5. Click Add.

    6. The Add or Edit Resource Allocation dialog appears.

    7. Select the PMC (from the dropdown) this allocation should go to.

    8. Enter the processor percentage to be allocated to the PMC.

      Screenshot of setting the Process match criteria to My P M C and the Percentage of processor to 50.

    9. Click OK.

    10. Add Resource Allocations for all other PMCs to be managed by RAP.

    11. Click OK.

  3. Activate the policy.

    1. Right click on the RAP created above.
    2. Select Set as Managing Policy.
    3. If prompted to disable the calendar, click Yes.
    4. Observe the behavior of the system while running an IIS load.