27 Jan 2011

Working with the Windows System Resource Manager (Part 1)

Sometimes a poorly written application can consume so many resources that it deprives other applications of the resources that they need. One way to prevent an application from consuming too many resources, such as memory and CPU time, is to regulate the applications use of resources by using the Windows System Resource Manager. In this article, I will show you how to use this tool to gain better control over your server's resources.
What's New in Longhorn Server

The Windows System Resource Manager is not a new tool for Longhorn Server. It was originally introduced for Windows Server 2003. The biggest difference between the Windows Server 2003 and the Longhorn Server versions is that the Windows System Resource Manager has become a part of the Longhorn Server operating system (Enterprise Edition only). As you may know, the Windows System Resource Manager was not included with Windows Server 2003. If you want to use the Windows System Resource Manager with Windows Server 2003, you can download a copy from the Microsoft website at: http://www.microsoft.com/technet/downloads/winsrvr/wsrm.mspx For the purposes of this article, I will be working with the Longhorn Server version.
Installing the Windows System Resource Manager

Although the Windows System Resource Manager is included as a part of the Longhorn Server operating system, it is not installed by default (at least not in the current beta). The procedure for installing Windows components in Longhorn Server is quite different from the method that you would use in Windows Server 2003. The Add/Remove Programs applet in the Control Panel is gone. Instead, you have to add and remove Windows components by using the Server Manager.

Begin the process by opening the Server Manager. When the Server Manager opens, select the Server Manager container at the very top of the console tree. When you do, the details pane should display summary information related to the way that your server is configured. Scroll through the details pane until you come to the Features Summary section, shown in Figure A.


Figure A: The Features Summary section is used to add or remove Windows components

At this point, you must click the Add Features link, shown in the figure. This will cause Windows to launch the Add Features wizard. The wizard's initial screen displays a series of check boxes which correspond to various Windows components. Select the Windows System Resource Manager check box. When you do, you will see a pop-up box informing you that you must also install SQL Server 2005 Embedded Edition. Click the Add Required Role Services button to select the necessary components and close the pop-up window, returning you to the wizard's feature selection screen. Click the Install button and the necessary services will be installed onto the server.

Using the Windows System Resource Manager

When the installation process completes, you can launch the Windows System Resource Manager by selecting it from the Administrative Tools menu. When the Windows System Resource Manager opens, you will see a prompt asking you if you want to administer the local computer or a remote machine. For the purposes of this article, select the local computer option and click the Connect button. If you happen to receive an error message, then verify that the Windows System Resource Manager service and the SQL Server 2005 Embedded Edition services are running. Once a connection is established, the Windows System Resource Manager console should look like the one shown in Figure B.


Figure B: This is what the Windows System Resource Manager console should look like after a connection has been established

Create Process Matching Criteria

Now that the Windows System Resource Manager is up and running, let's begin by creating some process matching criteria. Creating process matching criteria allows you to define an application or a process so that resources can be allocated to it.

The first step is to pick out an application that you want to create a process matching criteria for. After doing so, right-click on the Process Matching Criteria container and select the New Process Matching Criteria command from the resulting shortcut menu. When you do, Windows will display the New Process Matching Criteria dialog box.

When this dialog box opens, the first thing that you'll be prompted for it is a criterion name. You can enter anything that you want into this field, but I recommend using a name that describes the process that you are going to define.

You must now specify the process, service, or application that you want to define. To do so, click the Add button. This will cause Windows to open the Add Rule dialog box. What you will do next depends on how you want to define the application, service, or process. For example, if you want to manually define an application, simply enter the application's path and filename into the Include Files or Command Lines field.

You also have the option of selecting an application, process, service, or even an IIS application pool from a list. If you look at Figure C, you'll notice a drop down list with the word Application in it. You can use this drop-down list to select either an application, a running process, a registered service, or an IIS application pool. Upon making your choice, Click the Select button and you'll see a list of options to choose from. If you happen to choose the Application option, Windows will simply display the contents of the hard drive rather than a list of applications. It's up to you to choose the application that you want to define.


Figure C: In this figure, I have defined Notepad as an application

Before I move on, I want to talk a little bit more about the properties sheet shown in Figure C. if you look closely at this properties sheet, you will notice that there is room for more than one file or command line. The reason for this is because you are defining an application. Sometimes applications are composed of more than one executable file. When defining an application, you can enter multiple files, or even a combination of applications, processes, services, or even IIS application pools.

If you look at the bottom of the properties sheet shown in Figure C, you will notice that there is a check box that you can use to exclude files or command lines. Occasionally you might run into a situation in which the defined application shares executable code with another application. When this occurs, you may not want to implement restrictions against shared code. The Exclude Files or Command Lines option gives you the ability to exclude components from an application's definition.

Click OK and you will be returned to the New Process Matching Criteria dialog box. As you can see in Figure D, the application that we have defined has been added to the Files or Command Lines list. Click OK one more time, and the application that you've just defined will be listed under the Process Matching Criteria container, as shown in Figure E.


Figure D: The application that we have defined has been added to the Files or Command Lines list


Figure E: The recently defined application is now listed by name under the Process Matching Criteria container


No comments:

Post a Comment