Whether you have just installed Windows NT and want to investigate NT further or you want to tune an existing installation, Performance Monitor is a good place to start. This utility lets you track variations in the use of system resources over time and set alerts on the use of specific resources. You can even monitor systems remotely, which is a great help in tracking down problems in your network. And Performance Monitor can measure application performance, not just operating system performance.
You will find Performance Monitor in NT 4.0's Administrative Tools folder. In NT 3.51 and earlier, look in the Administrative Tools program group. No major differences in Performance Monitor's functionality exist between the versions of NT.
Selecting Parameters to Monitor
When you first open Performance Monitor, you see the blank Chart screen. You must select which objects, instances, and counters to monitor. To begin, click the + icon on the toolbar, or use the Edit, Add To Chart menu option. Screen 1 shows the result.
An object is any system component that has a set of measurable properties. An object can be a physical component (such as a hard disk, memory, or a CPU), a logical component (such as a disk volume), or a software component (such as a process, a thread, or a redirector).
An instance shows how many occurrences of a particular object are in the system. For example, Screen 1 shows only one Processor instance (in true programming fashion, called instance 0), so you know that this computer has only one CPU. However, if you look at the PhysicalDisk object on this computer, you see instances 0 and 1, because you have two physical hard disks. New in NT 4.0 is Total instance, which gives you the combined values for all instances.
Each object has multiple counters, each of which is a measurable attribute of the object. In Screen 1, the Processor object has several counters, including the percentage of processor time in use and percentage of time the CPU spends in Privileged and User modes. By default, Performance Monitor opens this selection screen with the Processor object as the focus and the %Processor Time counter highlighted. This counter is one of the most commonly used counters and, therefore, a good choice for a default. You can monitor many counters, but some are more important than others. Table 1 provides a good starting point for choosing counters. Select the counters you want to monitor, and click Add to include them in the display. For a concise and useful explanation of a counter, click Explain. When you finish adding counters, close this selection window and watch the graphical display.
Performance Monitor has approximately 350 different counters. Screen 2 graphs performance for several counters. The peaks in the CPU usage are from running the Pinball utility (OK, game) in demo mode, which takes all of my 486DX4-100. At the same time, I was copying some files across the network, so I was also measuring the disk writes and bytes per second on the network. Each counter is a different color on the graph, and you can customize the display. If you are showing the graph to a group of people, particularly on a projection system, you can make the lines on the chart thicker. And if necessary, you can vary the scale for each item, although I've found the default values are usually close to what I want.
A legend of the monitored counters appears at the bottom of the screen. Click a counter to have the values appear in the boxes just above the legend. The values listed are the last, average, maximum, and minimum values, and the timescale in seconds for the chart display.
Hints and Tips
While you're looking at the chart, press Ctrl+H. This command thickens the white line for the counter you've selected and makes identifying this counter easier when you have multiple counters displayed on the same screen. Press Ctrl+H again to turn off this option.
Oh yes, let me mention a couple of things that everyone, including me, finds confusing. First, if you want to monitor disk parameters, you have to go to a command prompt, type
and reboot the computer. To turn this option off, you must type
and again, reboot. Microsoft added this step because monitoring disk performance imposed a 1 percent to 2 percent performance penalty on a 386-based system. Pentium and 486 systems do not suffer from this performance penalty. Now that NT 4.0 runs only on 486 and better CPUs, Microsoft needs to consider turning on disk monitoring as the default.
Be aware that you can easily confuse the Process and the Processor objects. The Process object represents a running program, in other words, an object using system resources. Its counters track how much of each system resource the process is using. The Processor object is the CPU, which is a system resource. Some counters, such as %Processor Time, appear in both objects, so you have to be careful which object you select when you pick the counters.
Charts, Reports, and Logs
The chart view in Screen 2 is only one way to analyze data with Performance Monitor. You also can generate reports and logs. A report is a text-based view of selected counters, as shown in Screen 3, updated at intervals. The default interval is every five seconds.
A log is a file in which you can trap data for analysis in Performance Monitor or another utility. You can build log files on a regular schedule to see how performance trends develop. Keep in mind that Performance Monitor does not allow for long-term trend analysis: The best you can do is take snapshots of the data at intervals and compare that data using a program such as Microsoft Excel. (Some third-party programs that offer the ability to analyze trends over time will soon be available.)
To set up the log, select the objects you want to track, as shown in Screen 4 . At this point, you select objects only, not counters. Performance Monitor will track all the counters for each object and store them in a log file.
Next, set the Log Options. Click the Options button on the toolbar, or select Options, Log from the menu. As Screen 5 shows, you must specify a log filename and an update interval. You also start and stop collecting data from this dialog box.
Once you've started data collection, the Status box you see on the upper right side of Screen 4 changes from "Closed" to "Collecting." After you collect the data, you can export it or look at it with Performance Monitor. Reading the data from Performance Monitor can be confusing at first: Use the Options, Data From menu option, and instead of measuring current activity, read in the log file. Now if you change to the chart, alert, or report view, you can select which counters to display (Performance Monitor limits your choices to only those objects you monitored for the log file).
You might be wondering, "What's the point of setting an alert on the historical data contained in the log file?" You can set an alert and see whether the counter reached some upper or lower acceptable limit during the time Performance Monitor was collecting the log. The alert works similarly to a simple search function.
For a system administrator, the ability to set alerts is one of the most compelling reasons to use Performance Monitor. You can set Performance Monitor to send an alert for any counter when the value goes above or below some set value. You can also run a program. For example, when the SQL Server transaction log reaches 90 percent of capacity, you can dump the transaction log (that is, back it up to tape and reclaim the space). Screen 6 shows the dialog box for setting alerts. Notice the multiple instances for the LogicalDisk object. Physical disk 0 has three logical drives--C:, D:, and E:--and physical disk 1 has one logical drive--F:. The alert is set to trigger if the total free megabytes on all the drives drops below 100.
Obviously, for this alert to happen, Performance Monitor must be running. You need to configure the Messenger and Alert services to start automatically.
Saving Your Workspace
Now that you've configured your charts, logs, reports, and alerts, save these configurations so you don't have to re-create them next time you use Performance Monitor. On the File menu, you have the option to save the settings. This option changes depending on whether you are looking at the chart, log, alert, or report. In addition to saving each view, you can save the workspace, which is the combination of the various views. The File, Save Workspace menu option will save all the settings in a file, which by default ends in a .pmw extension. Then you can restore the workspace exactly as it was the next time you use Performance Monitor, using the File, Open option to read in your stored settings file. You can store different combinations of counters in separate .pmw files and recall them as needed. You might have one set of Performance Monitor parameters for measuring database applications, another for watching network traffic when backups are taking place across the network, and so on.
Monitoring Remote Computers
You can monitor another system as easily as your own, if you have the necessary access rights. At the top of the Add To Chart screen you see in Screen 1, find the computer name. Click the ellipsis to the right of the computer name to bring up a selection dialog box that shows the domains, workgroups, and computers in your network. Select the computer you want to monitor, select the counters for that computer, and close the selection window. At the bottom of the chart screen in Screen 7, the computer name appears with the parameter you're monitoring. The peaks on the graph occur when the screen saver is activated on the remote computer. The drain on CPU resources is the reason screen savers are not recommended on servers!
Is Overhead a Problem?
Performance Monitor is a process running on your computer, so it will take up some resources. You can track how Performance Monitor affects your system by looking at perfmon, one of the instances in the Process object. Most of the impact is in the CPU resources needed to run the Performance Monitor display, not to track the counters. This effect is one reason some system administrators and database administrators prefer to run Performance Monitor on another computer and monitor the database server remotely. Then the only effect on the server is in passing the counters back to the monitoring system, which does not take up much CPU time.
When you select an object in any view, Performance Monitor collects data on all the counters for that object but displays only those you specify. Again, the overhead is not significant compared with the demands of the on-screen display, which is updated continuously. The Performance Monitor process runs at a priority 12 (normal priority is 8, or 7 for NT 3.51 and earlier), so Performance Monitor gets the CPU cycles it needs to update the screen.
Applications can add their own counters to NT's Performance Monitor. For example, SQL Server adds more than 35 new counters. Screen 8 shows some SQL Server objects. (The objects will appear in the Performance Monitor selection screen only if SQL Server is running, so don't worry if you don't see them on your system.) IBM's DB-2 for NT adds approximately 140 counters. This feature is neat because you can monitor both the application counters and the system counters at the same time on the same screen. For example, you can monitor the number of transactions per second in a database, against the network traffic. Does the network traffic increase dramatically when one group of users runs queries? If so, perhaps they are moving too much data across the network rather than using client/server methods to reduce the traffic.
If you are building applications to run on NT, you can add counters to Performance Monitor and make them available to your users. This approach saves you the trouble of writing all the code needed to monitor performance in your application and provides a high level of integration with the operating system.
Performance Monitor offers many more options than I've covered in this article, and all are relatively easy to use. You can customize the appearance of your charts, add vertical and horizontal grids, vary the update interval, and display data as histograms instead of lines on the chart. The real challenge is to become familiar with the various counters and know what to monitor in your network. (For further information on Performance Monitor's capabilities, see "Related Articles in Windows NT Magazine," and "References.")
For more information on Performance Monitor, see Microsoft's Resource Kits for Windows NT:
Microsoft Windows NT 4.0 Workstation Resource Kit
Chapters 9 through 16 cover perfor-mance measurement, tuning, and optimization with Performance Monitor, Task Manager, and other tools, some of which are in the Resource Kit.
Windows NT 3.5/3.51 Resource Kit
This Resource Kit contains an entire volume on Performance Monitor, "Optimizing Windows NT." The first part is an introduction to Performance Monitor, followed by a section on bottleneck detection. The second part of the book is for programmers and shows how you can add your counters to Performance Monitor. This programming information did not make it into the NT 4.0 Resource Kit, so if you have a copy of the NT 3.5 Resource Kit, hang on to Volume 4.
You can find Performance Monitor Counter Definitions in a help file,
hlp, on the CD-ROM that comes with the Windows NT 4.0 Workstation and Server resource kits.
RELATED ARTICLES IN WINDOWS NT MAGAZINE
Mark J. Keller and David P. Stevens
"Tuning SQL Server," January 1996
Robert D. Schneider
"10 Easy Tips for Better SQL Server Performance," October 1996