System conflicts for resources usually occur when applications demand resources already in use by others or try to forcefully have them allocated to themselves. Some applications also misbehave and pre-allocate resources even though some of them may not used in the current session. To overcome this, in Win NT/2000/XP you use the Task Manager to find an errant application that’s hogging system resources and then turn it off. It can, however, happen that the application is a mission-critical business application that shouldn’t be turned off. Moreover, ‘end-tasking’ an application is no solution. It just postpones the problem, which usually occurs again. Enter WSRM or the Windows System Resource Manager!
WSRM, introduced in the Windows Server 2003 family, automatically manages system resources according to pre-configured parameters, ensuring optimal performance and greater system stability. But, how does it work?
Using simple process-monitoring techniques, that are a natural extension of the multitasking features of OSs, WSRM actively keeps track of the different resources demanded and in use by your applications. As the administrator, you can fine-tune these settings from the WSRM add-in in the Windows System Resource Manager Console. You can even set up preferential priorities to allocate extra resources to particular applications at particular times. For example, during the day, since a database server needs to execute mission-critical queries, you can allocate maximum CPU to it, whereas during weeknights, the database will be backed up and, at this time, you may allocate the query engine lesser CPU priority, while maximizing it for the backup engine.
Although WSRM does not have an instantaneous effect (it takes a few secs sometimes for the routines to kick in and take action), it is still pretty effective in reducing the ill effects and ensuring greater stability.
STEP ONE
Install WSRM
If you don’t have the WSRM CD, in your kit, you can download it as an ISO CD image from
www.microsoft.com/windowsserver2003/ downloads/wsrm.mspx. After downloading it, you need to burn it onto a CD-ROM before you can use it. Pop the CD into your drive. Inside the Setup folder on the CD, you will find two folders.
The IA64 folder is for the Intel Itanium 64-bit systems and the X86 folder for 32-bit systems. Run the setup.exe file from the appropriate folder for your system. We used the X86 installation. If prompted, reboot your system.
We will use the sample programs provided on the WSRM CD for our demonstrations. So, copy these files from the Samples folder on the CD to any location on your hard drive. You will see a set of XML files among these samples. These are configuration files for the WSRM. We will use these below. After installation, the Windows System Resource Manager console will appear in your Administrative Tools folder. Launch this program now.
STEP TWO
Configure WSRM
First, you need to define the Process Matching Criteria. WSRM will use these as rules to match your conditions against
running programs and decide on the appropriate allocation policy accordingly. As with all rule-based systems, you can either set Include or Exclude rules. To set exclude rules, you must check on the Excluded Files or Command Lines box. Similarly, you can set up the rule to work only for a particular set of users (again, included or excluded). You can do this from the Users or Groups tab on the same box.
Next, you need to set the criteria and resource-allocation policies. To do this for our demonstration, right click on the root item on the tree, Windows System Resource Manager (COMPUTERNAME). Then, select Import WSRM Information. You will be asked for a location. Browse to the location where you saved the files from the Samples folder. You will be prompted to whether you want to overwrite your WSRM configuration. Answer OK to this. This step uses the XML files we saw above. The settings will be imported and your screen will refresh to look like the screenshot of the WSRM console.
STEP THREE
Set rules
The Equal_Per_User rule, as you can see, has 99% CPU available to any application (Equal_ Per_User criteria has an * as its setting, meaning ‘everything’). Similarly, the DayTimePolicy will allow BizCrit 70% and Batch 25% CPU. NightTimePolicy allows Batch 60% and BizCrit 30% CPU. StopLeak will allow all applications to use the CPU except Leaky.
STEP FOUR
See policy in action
The demo from the samples folder has four exe files, named Batch (simulates batch processing requirements), BizCrit
(simulates a business critical application), Leaky (lots of memory leaks) and Rogue (misbehaving application). The rules we imported don’t have sets for the Rogue application. For now, just double-click and launch the BizCrit and Batch applications. These two are present in most of the rules.
To view the effects of each policy, right click on the particular policy and select Set as Managing Policy. You would need to wait a couple of seconds for it to take effect. Now, go to the Resource Monitor item, the second last in the tree. It will show the graph for the currently running policy. To see the changes as they happen, remember to right-click on the policy item. If you left click before right clicking, the right-side display will change to show the policy settings and it will take a while for the graph to reappear when you switch back to the Resource Monitor.
STEP FIVE
Protect against resource leaks and hogging
The Rogue and Leaky demos are meant to demonstrate what happens when applications misbehave or have memory leaks in them, respectively. When you run these demos, you will notice a difference only when you set StopLeak as the managing policy, because the other policies do not recognize this application as one they should manage.
Sujay Sarma