SolutionBase: Implementing the Windows Server 2003 System Resource Manager

Use this free tool from Microsoft to make Windows Server 2003 more efficient.

You've probably noticed by now one key fact in IT—the more you use your server, the more you use your server. Before you know it, the server you purchased with plenty of room to grow has started to bog down because you've given it so much to do. If your IT budget can't afford a new server and another version of Windows Server 2003 Enterprise Edition, you're in luck. Using Microsoft's free add-on for Windows Server 2003 Enterprise Edition, the Windows System Resource Manager, you can help your server more efficiently execute the tasks you've given it. Here's how it works.

Why use WSRM?
The Windows System Resource Manager (WSRM) is an add-on for both Windows Server 2003 Enterprise Edition and Windows Server 2003 Datacenter Edition that enables you to allocate processor and memory resources among your various applications based on business priority. This means that a business critical application can be configured to receive more processor time and memory than a less important application.

Normally when applications are running on a Windows Server, each application takes as much memory and CPU resources as it can get. The problem is that some applications tend to be greedier with system resources than others. This means that a relatively unimportant application might be taking much needed resources away from business critical applications. With WSRM, you can create policies that will allocate more system resources to your business critical applications and fewer resources to less important applications.

As you can imagine, WSRM can greatly improve the response time for business critical applications, but that isn’t all it does. It also allows your server to do more with less. As you probably know, a single copy of Windows Server 2003 Enterprise Edition with 25 Client Access Licenses costs about $4,000. If your company has a lot of servers to upgrade, the upgrade cost can quickly grow to a staggering figure. However, if you can consolidate multiple application servers into a single server, then you can greatly reduce the cost to your organization because you will need fewer server licenses.

This is where WSRM comes in. WSRM allows you to squeeze every last bit of processing power out of your server by regulating the amount of processor time that each application is consuming.

Likewise, WSRM may also reduce the amount of money that your IT department has to spend on hardware upgrades. A server with a processor that's maxed out is often able to handle a couple more applications once the currently running processes have been optimized and restricted from using excessive amounts of processor time.

One of my favorite features found in WSRM is the policy scheduling feature. As I explained earlier, WSRM allows you to create policies that dictate the amount of system resources that will be used by various applications. While it's great to be able to set up such a policy, not all situations call for applications to have the same priorities. For example, at one of the companies where I used to work, there were several hundred data entry clerks entering data during the day. At night though, there were only about 20 data entry clerks working. The real work being done at night was the optical scanning of documents.

Had WSRM existed back then, it would have been possible to create separate policies for daytime and for nighttime. The two separate policies would have reflected the differences in the type of work being done during the day and night.

You can even create a holiday policy. A holiday policy would be a policy that is active for one day on specific days of the year, such as July 4 and December 25. The idea behind a holiday policy is that since most of the workers are out of the office, you can alter the server’s priorities for that one day to better accommodate those workers who are in the office.

Another nifty feature of WSRM is the ability to monitor applications suspected of having memory leaks. If an application consumes more than a threshold value of memory, then WSRM can either shut down the application or place an entry into the event log.

While server optimization is certainly the biggest reason for implementing WSRM, there are also a couple of unexpected side effects to using WSRM. First, the monitoring component can give you a more clear view of exactly what is running on your server and which process is consuming the most resources. You may find resource hogs that you didn’t know existed.

Another interesting side effect is that with the way that WSRM manages resources, it is now possible to run multiple instances of the same application. This is especially beneficial for those organizations that are running Terminal Services. It is possible to use WSRM to make sure that no one Terminal Service user consumes a disproportionate amount of the server’s resources.

WSRM might be able to do lot, but it can't do everything. First, WSRM can't prioritize the operating system’s use of resources. WSRM will only prioritize application level resources. Those are the resources that are not being used by the operating system itself.

Another thing that you can’t do is use WSRM to schedule or start applications or services. All WSRM does is prioritize applications and services. Starting and stopping those applications is up to you.

Finally, WSRM can’t manage cluster servers. WSRM needs to have a separate policy for each physical machine, and is therefore unsuitable for clustering.

Acquiring WSRM
As I said, WSRM is a free add-on for Windows Server 2003 Enterprise and Datacenter Edition. You can download this add-on directly from Microsoft's Windows Server 2003 Web site. The downloadable file is about 36 MB in size, so it might take some time to download.

Unlike most of the downloadable files on the Microsoft Web site, this one is not a self-extracting executable. Instead, the file is made available in ISO format. An ISO file is a CD Image. To extract such file contents, I simply used Roxio’s Easy CD Creator Platinum to create a CD based on the image.

Installing WSRM
To install WSRM, insert the CD that you’ve just created into your server. After doing so, go into the CD’s Setup\X86 folder and run the Setup program. When you do, Windows will launch the Setup Wizard. Click Next to bypass the wizard’s Welcome screen and you’ll see the end user license agreement. Accept the license agreement, click Next, and you will see a list of the components being installed. By default, the server and the client components will be installed. Go ahead and allow both components to be installed. Doing so will consume only 1671 KB of disk space.

Click Next and the Setup wizard will ask you if you want to enable accounting. I recommend enabling accounting because doing so will allow you to track CPU resource usage. By tracking CPU utilization, you will be better able to configure your applications. Click Next and Setup will begin to install the necessary files. When the file copy process completes, the wizard’s final screen has the Start WSRM Server Management After This Wizard Is Closed check box selected by default. Keep this check box selected and click Finish to launch the Windows System Resource Manager. You can also launch this application by selecting the Windows System Resource Manager command from the server’s Administrative Tools menu.

Implementing a default policy
When you initially launch WSRM, nothing is configured except for accounting. Therefore, the first thing that you will want to do is to implement a default policy. To do so, expand the console’s Resource Allocation Policies container to reveal the existing policies. Right-click on the Equal_Per_User policy and select the Set As Managing Policy command from the resulting shortcut menu to activate it. This policy assigns an equal amount of processing time to each application or user.

So far, you have enabled a policy that grants an equal amount of processor time to each user/application. This should improve your server’s current performance because the policy will prevent any one application from consuming an excessive amount of resources. Now it’s time to get down to business though and see which applications have been consuming which resources. As you may recall, during the Setup process, Setup asked if you wanted to enable accounting, and I said to leave accounting enabled.

WSRM polls your server every ten minutes to see what's running and how many resources those resources are consuming. You can view a list of these resources, as shown in Figure A. If you scroll this list to the right, you will see that this list offers a rather extensive amount of information about each process. In fact, the list can quickly become overwhelming.

Figure A
The Accounting container contains information about all processes and the resources that those processes are consuming.

Fortunately, you can filter the list to search for specific processes. You can also archive past accounting entries. One thing to keep in mind is that accounting entries are never automatically deleted by the system. Therefore, if you want to keep all of your old accounting logs, then it’s best to archive them to a location other than the volume containing Windows. This will keep the system partition from running out of disk space as a result of the log entries growing too large.

If you want to archive the log entries, simply right-click on the Accounting container and select Archive Information. When you do, you will see the Archive Information dialog box appear. To archive information, you must select a date range that you want to archive. Set the start and ending date, the archive path, and the archive file format. Supported formats include tab delimited, CSV, and SMF. If you’d rather disable accounting than have to continuously archive accounting information, then you can do so by right-clicking on the Accounting container and selecting Disable from the shortcut menu.

When you right-clicked on the Accounting folder, you might have noticed the Filter View command on the shortcut menu. This command allows you to filter the information shown in the Accounting section of the WSRM console. You can filter by date, by policy, or by the values in any one of the columns. The filtering capabilities are actually quite powerful, so if you are looking for a specific piece of information within the accounting logs, the filters are sure to help you find it.

Creating a policy
Now that I have shown you how to use the accounting feature, I want to show you how to create a policy. To create a new policy, right-click on the Resource Allocation Policies container and select the New Resource Allocation Policy command from the resulting shortcut menu. When you do, you will see the New Resource Allocation Policy dialog box shown in Figure B.

Figure B
The New Resource Allocation Policy dialog box allows you to develop a new resource allocation policy.

When creating a new policy, the first thing that you have to do is to assign the policy a name. For demonstration purposes, I will give my new policy the name Posey. The next thing that you have to do is to start allocating CPU resources.

The thing that you need to know about allocating CPU resources is that CPU resources are measured in percentages of the CPU’s total capacity. The resources that you assign have to add up to 100 percent. Furthermore, you must leave at least some CPU resources for default usage. Default usage refers to CPU time that is used for applications that are not defined by the policy.

For example, you probably wouldn’t take the time to specify CPU resources for Notepad, because it is small and is used infrequently compared to services that are running all the time. However, it is conceivable that someone could walk up to the server console and open Notepad. As such, the only way that Notepad would be able to get any CPU time at all is through the default usage portion of the policy. Although there are policies that use as little as 1 percent of the CPU’s resources for the default usage, Microsoft recommends setting aside at least 5 percent of the CPU’s capacity.

At this point, click the Add button and you will see the Add Or Edit Resource Allocation properties sheet. As you can see in Figure C, the default values on this properties sheet’s General tab assign 99 percent of the CPU usage to the Equal_Per_User process matching criteria. This is because this is the only process match criteria that presently exists. To create a new one of your own, select the New option from the Process Matching criteria drop-down list. When you do, you will see the New Process Matching Criteria dialog box appear.

Figure C
The Add Or Edit Resource Allocation properties sheet allows you to set the process matching criteria.

You must begin by entering a name for the criteria that you are about to define. For demonstration purposes, I will call this criteria Critical, to represent my business critical applications. After entering the name of the criteria, you have to set up some rules. To do so, click the Add button. When you do, you’ll see the Add Rule properties sheet. This properties sheet allows you to specify files or command lines relating to the applications that you want to include in the rule. There is also an exclude section that you can use to specifically exclude applications from the rule. Likewise, the Add Rule properties sheet contains a Users or Groups tab. This tab allows you to create rules based on the user or group that is running a process.

When selecting applications, you can use the drop-down list to choose between registered services, running processes, and applications. Select which of these categories your application falls into and click Select. You will then see all of the applications that fall into that category.

It took a little time to build the list of my business critical applications, but I was able to do it by selecting various running processes and registered services. Essentially, my business critical applications consisted of Microsoft Exchange Server, IIS, ViRobot Management Server (my enterprise class antivirus solution), GFI Mail Essentials (my antispam software), and the software that drives my HP all-in-one machine. You can see this filled-in screen in Figure D.

Figure D
Select the processes, services, and applications that you want to include in the rule.

When you click OK, the applications that you selected are added to the New Process Matching Criteria list, as shown in Figure E.

Figure E
The applications that you selected are added to the New Process Matching Criteria list.

You are now returned to the Add Or Edit Resource Allocation properties sheet. The Process Matching criteria is now set to Critical (to reflect the name I assigned earlier), but the percentage of processor time allocated for the resource is still set to 99 percent. In this particular case, I am going to bump this down to 70 percent. The reason is because I have a lot of noncritical applications on the server, including SQL Server 2000.

Although my business critical applications are more important, I still want to make sure that SQL Server and my other critical applications still receive adequate processor time. Click OK and you will be taken back to the New Resource Allocation Policy dialog box. As you can see in Figure F, the Critical applications have been assigned 70 percent of the CPU time. Click OK to close this dialog box and create the new policy.

Figure F
The Critical applications have been assigned 70 percent of the available CPU time.

After clicking OK, you will see the name Posey appear among the list of available policies. If you select Posey, you will see that critical applications now receive 70 percent of the CPU time and default applications receive 30 percent of the CPU time, as shown in Figure G.

Figure G
The new policy allocates 70 percent of the available CPU time to critical applications and 30 percent to default applications.

Although I have created the new policy, the policy is not active. To activate the new policy, right-click on it and select the Set as Managing Policy command from the resulting shortcut menu.