Performance Tuning Your Network

Congratulations! Your Windows NT network is up and running. All the client software is loaded, you've figured out enough TCP/IP to make it work, and you've got your 4GB hard disk set up so that Jack can't get into Jill's personal stuff, and Jill can't get at Jack's. Time to kick back, right? Well, maybe just a little. Then you start to worry. Can I make it faster? Is it efficient enough? Could I squeeze some extra power out of my server by tweaking some system parameter? What will happen when the server's hard disk is full? Can I foresee that somehow?

There's a lot you can do to improve on an initial installation, and the tool that will help you do it is the Windows NT Performance Monitor--Perfmon to its friends. Perfmon is a terrific application, an in-depth tool that allows you to collect and examine tons of data on your system. NT users often don't appreciate what a great bargain Perfmon is. After all, a network monitoring tool like this one usually costs thousands of dollars extra, but Perfmon is part of NT.

You don't need to do anything to put Perfmon on your system, because it installs automatically when you install NT. Look in the Administrative Tools group to find it. Its opening screen looks like Screen 1.

Perfmon starts in Chart mode. The chart is blank because you have to tell it what to track; there are literally hundreds of items it can monitor. For example, let's track the CPU utilization rate. This is a number that shows what percentage of the time the CPU spends actually working and not waiting for something to do. It can be an important indication of whether your CPU is powerful enough to act as a server for your network, so it's worth monitoring. Click on the button on the toolbar with a plus sign on it, and you'll see a dialog like the one in Screen 2.

The dialog already has % Processor Time highlighted, so just click on Add, and the Cancel button will change to Done; click on Done, and Perfmon will begin to chart CPU utilization. After it runs for a while on a lightly loaded network, it might look something like Screen 3.

The graph is a good way to see how processor utilization varies. But Perfmon also reports the most recent value (1.641), the smallest value in the recording period (0.150), the largest seen in the recording period (47.509), and the average value (6.154). These aren't all-encompassing statistics, but they're a nice at-a-glance look at what you're monitoring.

Before going on, however, let's take a look at all the things in the dialog in screen 2. Click on the Computer field, and you'll see the other computers in your domain.

If you have Administrator privileges, you can do more than just monitor CPU utilization on a particular computer; you can choose all your servers and graph the CPU utilization on each of them. This enables you to see how busy your servers are--or aren't--from a single machine. Furthermore, you don't need to do this from an NT Server machine; you can run Perfmon just as easily from an NT Workstation. I understand that there is even a Windows 95-compatible version of NT's Perfmon, but I haven't seen it yet. (Don't confuse it with the smaller, less capable Performance Monitor that comes with Windows 95; it can't do half of what the NT Perfmon can, partly because of the different architectures of NT and Windows 95. Even if you run the NT Perfmon made for Windows 95, it lacks some of the flexibility that is built-in under true NT.)

The Object field contains the value "Processor" in this example. The things that Perfmon can monitor are called counters. CPU utilization is one example of a counter. A counter is a piece of information that is associated with an object. CPU utilization, or % Processor Time, is a counter describing the processor itself; hence, that counter is part of the Processor object.

The word object works well when you're talking about Processor or PhysicalDisk, two Perfmon objects, but all objects are not concrete physical items. For example, each process or program that runs on your system is an object. The protocol stacks that govern transferring data around your network are objects too, such as NWlink IPX or NetBEUI. This concept is useful for Perfmon, because developers can extend it with new objects. For example, when you load SQL Server on an NT Server, you'll see a group of new objects in Perfmon that are relevant to SQL Server.

The Instance field exists in case you have more than one occurrence of a particular object. In screen 3, you see a 0 in that field because the computer I used had only one CPU--CPU number 0. If there were more processors, you would see a 1, 2, 3, or whatever.

There's another usage of the Instance field that presents an alternative format for the chart. Let's assume your server is running slowly. You've already charted CPU utilization, and it averages about 85%, so you know that your CPU is working hard. But why? Is it time to buy an Alpha? Maybe! Maybe not! Let's find out what program is taking up all the CPU time.

First, to see a histogram rather than a chart, click on Options, Chart, and then Histogram. Choose a new chart by clicking on File and New Chart. Bring up the Add to Chart dialog, and choose the Process object. When you do, you'll see the Instance field fill up with the names of all the processes running on the server. Click anywhere in the Instance field, and press \[Ctrl\]\[/\] to select all the processes. Click on Add and then Done, and you'll see a series of bars representing the amounts of memory used by the different processes on your server. The longest bars will show you the names of the culprits. Then you can move them to another computer or even shut them down if they're not essential.

That's just the beginning. You can use Perfmon to keep track of how much free space is on a disk--use the object LogicalDisk and the counter Free Megabytes. Perfmon also offers an Alert mode that sends you a message when something happens, sort of an automatic watchdog for your network. You put Perfmon in Alert mode by clicking on View and then Alert. For example, suppose you want Perfmon to alert you when the number of free megabytes on drive D falls below 50. Click on the plus button on the toolbar, and you'll see a dialog similar to the one in screen 2. Select LogicalDisk, counter Free Megabytes, and Instance D, and the dialog will look like the one in Screen 4.

What's different about this dialog is the Alert If and Run Program on Alert fields. To make Perfmon alert you if disk D drops below 50MB of free space, put 50 in the empty edit field, and click on Under. Every five seconds, Perfmon checks to see if the D disk has less than 50MB of free space. If it does, a line appears on the Alert screen to that effect.

If you want something more eye-catching, tell Perfmon to find you when an Alert occurs. Click on Options and Alert; a dialog appears with a number of options, including Network Alert. Check the box labeled "Send network message," and fill in the Net Name field with either a machine name or a username. If you want Perfmon to inform you when a low-disk-space condition occurs, then enter your network username. If you have a particular computer that acts as the network control console, then enter that machine's name, and whoever is logged on to that machine will get the Alerts. You're only allowed to enter one name.

While you're at it, you can also modify the update times in Interval (in seconds). By default, the server will notify you every five seconds if it finds insufficient disk space. That is a mite shrewish for my taste; I'd adjust the interval to 120 seconds. You can even have the Alerts saved in the Event Log; that's another box in the dialog.

Screen 4 also contains a field labeled Run Program on Alert. Perhaps you've already created a program that clears out unimportant files, freeing up disk space. To run your program whenever the system is out of disk space, just specify it in Run Program on Alert.

One of my servers had a sound board in it for a while, so I got an audio clip from Star Trek called WARPCORE.WAV that says, "Warning ... damage to warp core ... containment failure in 30 seconds." I put the name WARPCORE.WAV in the Run Program on Alert field. NT automatically uses the media player to play .WAV files, so the data file's name was all I needed. The first time I had low disk space, the sound file played, and everybody in the office jumped. (Two comments about that sound file: First, it's really only funny the first time, and second, do not ask me for the file. It is owned and jealously guarded by Paramount Pictures, so contact them.)

You may want to take the information you get from the Chart or Alert view and export it to a format that a word processor, database, or spreadsheet can use. To do that, use the Report view. Click on Options and Report. When you add items to the report, you'll see a formatted report on the screen. You can export it in either comma-delimited or tab-delimited ASCII format for easy importing to external programs.

To really analyze your network, however, you shouldn't take snapshots and try to draw conclusions from them. Instead, you should tell Perfmon to record system information over a longer period of time. That is done with the Log setting. Log allows you to choose a set of objects--not just counters--and save it to disk in a log file. Then you can reload the log file and examine the information in it later.

For example, suppose you want to find the average CPU utilization of a server for a week. Go to the Log option by clicking on View and Log. Click on the plus button on the toolbar, and you'll see that Perfmon now shows you only the option of choosing objects, not the counters within objects. Choose the Processor object--the CPU utilization value is there--click on Add and then Done. You'll see a screen telling you that you're logging the Processor object. But the screen isn't too clear about the fact that you're not saving any data yet. To get Perfmon to start actually saving data regularly to disk, click on Options, then Log, and a dialog labeled Log Options appears (see Screen 5).

File Name lets you choose the name of the file to use when saving the logged data. Update Time lets you choose how often to update the data. You don't want to log any more often than every 60 seconds; you'd be surprised how quickly you can fill your server's hard disk with a log file! Then, click on Start Log before you click on OK, or nothing will happen. After you click on OK, the main Log screen reappears. It shows how long you've been logging, what you're logging, and how large the log file is at the moment.

Now that you have all that data in the log file, how do you analyze it? First, tell Perfmon to reload it by switching to Chart view and clicking on Options, then Data From. You'll get a dialog that lets you tell Perfmon to chart data from a log file rather than from the real-time data. As before, you must pick which counters to examine, but now you're only offered the counters that you logged. You can fine-tune the period of time to examine the data by clicking on Edit and then Time Window.

A few notes on using Perfmon and disks: You can't use the PhysicalDisk object until you open a command line, enter diskperf -y, and then reboot your system. Until you do, all the PhysicalDisk information will come up blank. If you're going to log disk information, set the log interval to 60 seconds, or, again, it won't work--it's a bug in Perfmon.

Now that you know how to use Perfmon, the next questions are: What are all those counters? Which ones should I use? The Windows NT Resource Kit--a must-have reference for NT system administrators--has a paragraph or two about each counter. Some paragraphs have good, clear explanations, and some don't. Which counters should you examine? That's another article.