Turbo-Charging Windows NT

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
By Brien Posey

Archived content - No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

On This Page

Eliminating Bottlenecks
Optimizing Your Swap File
The Microprocessor Myth


Published in NCC Technology Publishing's Windows NT Help Desk Report

Do you sometimes think your computer runs too slowly? If so, you'll be happy to know that you have several options for optimizing Windows NT's performance. In this article, we'll show you several techniques that you can use to make Windows NT run more efficiently. Best of all, these techniques work equally well on Windows NT Workstation and Windows NT Server.


Before you can effectively optimize Windows NT, you need a general strategy. The optimization process consists of two phases: eliminating bottlenecks and tweaking your applications. A bottleneck occurs when one hardware component in your system keeps NT from performing up to your system's overall potential. Every system has a bottleneck, regardless of how fast your computer is—inevitably, one component is slower than the rest.

Eliminating Bottlenecks

We once received a letter asking about the best single way to improve Windows NT's performance. The answer to that question is simple: Add more memory. If you truly want to maximize Windows NT's performance, the first thing you should do is upgrade your computer with as much RAM as it will allow. The vast majority of bottlenecks on Windows NT-based systems are due to insufficient memory.

Extra memory will help Windows NT run much faster by reducing the required amount of disk access. Disk access (measured in milliseconds) is much slower than memory access (measured in nanoseconds).

Optimizing disk access

Although the hard disk is usually the slowest component in your computer, it doesn't necessarily have to be the bottleneck. As we just mentioned, the more memory that you put in your system, the less your computer will have to access the hard disk.

Of course, no matter how much memory your system has, you can never completely prevent it from accessing the hard disk. That's because when you turn on the computer, its memory is empty. In each session, your computer must initially access the hard disk for every file it needs. Once your computer accesses a file for the first time, it can cache the file—that is, copy the file into memory. The next time your machine needs to access that file, it reads the file from memory rather than from the hard disk.

Actually, we've oversimplified the process of disk caching: Very few computers can cache the entire hard disk and have memory left over for running programs. So, Windows NT uses a process called paging to move information between RAM and a file on your hard disk called a swap file or page file. Because Windows NT depends on your hard disk to initially read files and for memory swapping, it's important to optimize your hard disk for maximum efficiency.

If you have multiple SCSI hard drives in your system, you have several options for speeding up disk access. If you have only one hard drive, or if you're using IDE hard drives, the options in the next section won't apply to you. In that case, skip to the section titled "Optimizing your swap file."

Disk striping

The first option you have for speeding up disk access is to implement disk striping. Disk striping works by segmenting files across multiple hard drives. For example, suppose you have a simple stripe set that uses three hard drives. Windows NT would see the stripe set as a single drive rather than three drives. If you copy a file to the stripe set, one-third of the file will be copied to each of the three hard drives. The advantage of doing this is that your computer is capable of reading from and writing to all three drives simultaneously. Therefore, disk I/O is three times faster with a three-hard-drive stripe set than it would be using a single hard drive.

Although disk access is faster using a stripe set than it would be using a single drive, you must keep in mind a potential risk. Remember that every file stored in the stripe set is actually stored in pieces—a little bit on each drive in the set. If you have problems with any of the drives involved in the stripe set, you'll lose all the data on all the drives, because a piece of every file will be damaged.

There's an easy way to prevent this type of data loss, but it comes at a cost. Windows NT supports an option called disk striping with parity, commonly known as RAID 5. RAID 5 keeps you from losing your data if a hard drive goes out. RAID 5 works by counting how many hard drives (X) are in your stripe set and reserving 1/X of each hard disk for storing parity information. For example, if you have three hard drives in your stripe set, RAID 5 will reserve one-third of each drive for parity information. If any of the hard drives crash, RAID 5 will use the parity information on the remaining drives to rebuild the lost information when you replace the hard disk.

If you add the amount of space reserved for parity information on each hard drive, you can see that you'll end up losing a total amount of disk space equal to one hard drive. The more hard drives you have in your stripe set, the lower the overhead. For example, if you have 3 hard drives in a RAID 5 set, you have 33-percent overhead—one-third of each hard disk is reserved for parity information. But if you have 10 drives in your RAID 5 set, you have only 10-percent overhead, because only one tenth of each hard disk is reserved.

Both stripe-set implementations will speed disk I/O. Disk striping can use between 2 and 32 hard drives, but disk striping with parity requires between 3 and 32 hard drives. In order to implement striping, the hard disks must be SCSI, contain equal-sized partitions, and be formatted as NTFS. Your boot drive can't be included in a stripe set, and neither can the drive containing Windows NT. Therefore, unless you have hard drives to spare, it's best to load Windows NT on your boot drive.

If you decide to create a stripe set, you can do so through Disk Manager by selecting the partitions to include and choosing the desired stripe-set implementation from the appropriate menu. The Create A Stripe Set option is located on the Partition Menu, and the Create A Stripe Set With Parity option is located on the Fault Tolerance menu.

Optimizing Your Swap File

If you don't feel comfortable with disk striping because of the associated risks or because of the overhead involved in RAID 5, there's another way to safely take advantage of some of the benefits of striping: spreading the swap file across multiple hard disks. This technique works in the same way as striping; but, rather than create a stripe set, each hard disk keeps its individual identity. The majority of the files will continue to behave normally.

By dividing the swap file this way, you gain performance improvements because you can read from and write to the swap file much faster than you could if it were located entirely on one hard drive. You may wonder how much performance boost you'll actually see, if you're spreading only one file across multiple hard drives. Keep in mind that Windows NT tries to cache just about every file it touches, and that your computer's memory probably isn't large enough to store all these cached files. When the memory fills up, the least frequently used of the cached files are written to the swap file. Therefore, chances are good that your swap file will usually contain some of the files your computer will use again.

To effectively segment your swap file, your system needs to be using SCSI hard drives. Begin by double-clicking on the System icon in Control Panel. When you see the System properties sheet, select the Performance tab. Now, click the Change button in the Virtual Memory section. When you do, you'll see the Virtual Memory properties sheet, shown in Figure A. You can now select the hard drives across which you want to span your swap file; simply set the swap file's initial and maximum sizes.


Figure A: You can use the Virtual Memory properties sheet to control which hard drives Windows NT uses for your swap file.


Here's one more trick for improving hard-disk access speed. One of the biggest reasons for slow disk access is fragmentation. As you probably know, disk fragmentation occurs as you create and delete files on your hard disk. When you initially begin writing files to a new hard disk, the disk stores the files in linear order. However, when you delete a file, it leaves a gap of unused space between other files. To avoid wasting this empty space, your computer will try to store other files there. If a new file is bigger than the file that was erased, your hard drive will store as much of the new file as it can in the empty space and will store the rest of the file elsewhere on the drive. The new file becomes fragmented.

Fragmentation slows the rate at which your computer can access files from the hard disk, because the hard disk's read or write head must move around to different areas of the disk to access various parts of the file. Each time that the head moves, your hard disk must stop reading or writing until the move is complete.

Although Windows NT doesn't come with a defragmentation program, as Windows 95 does, several commercial utilities are available from third parties, such as the one shown in Figure B. If you'd like to try defragmenting your hard disk before you spend the money on a defrag program, you can download a trial version of Norton's Speed Disk by Symantec, from http://www.shareware.com.


Figure B: You can increase the efficiency of your hard disk by using a disk defragmenter.

The Microprocessor Myth

Many people think your system speed will double if you add a second microprocessor—but this isn't true. As you may know, programs are composed of threads. These threads are given to the microprocessor for execution. If your computer routinely handles only one single-threaded program at a time, then a second processor won't help you, because NT isn't capable of splitting threads. A second processor will help boost system performance only if you're running a multi-threaded application, or multiple applications, or both. Even then, a second processor won't double your computer's speed, because some of your computer's processing power is used to juggle the workload between processors.

Despite this fact, there are times when a second processor will really help your computer run faster. This is especially true if you have an NT Server running a BackOffice package such as SQL or Exchange.

If you want to increase the performance of workstations or low-end servers, you might consider upgrading your existing processor to a faster one, rather than adding a second processor. Performance Monitor includes a counter you can use to determine whether a faster processor will help Windows NT run more quickly.

To see how your processor stacks up, open Performance Monitor and choose the Edit | Add To Chart menu item. When the Add To Chart dialog box opens, select the Processor object and the %Processor Time counter, as shown in Figure C, and click the Add button. Performance Monitor will display the percentage of processing power your computer is using, as shown in Figure D. At this point, subject your computer to a normal workload. It's OK to have your processor utilization spike to 100 percent—but if your counter averages more than 80 percent, your computer needs more processing power.


Figure C: Select the Processor object's %Processor Time counter.


Figure D: Performance Monitor can show you how much of your computer's processing potential is being exploited.

Controlling the way your system runs

We've discussed several ways you can speed hard-disk access; now, let's take a look at a different way to increase performance. One little-known way you can boost your system's performance is to control how much processor time various items receive. As you may recall, Windows NT runs several processes in the background, as shown in Figure E. Some of these processes—such as the one that controls the mouse driver—require lots of processor cycles to run correctly. (Imagine how jerky your mouse would be if Windows NT checked its position only once per second.) At the same time, other system processes require relatively few processor cycles.


Figure E: Windows NT runs many processes simultaneously.

Because of the diverse needs of these programs, Windows NT allows you to control how much processor time each individual process gets. To see how much time a given process receives, open the Windows NT Task Manager and select the Processes tab. Right-click on the process whose priority you want to change and select Set Priority from the resulting context menu. As you can see in Figure F, you can select from four priority levels for each process.


Figure F: You can use Task Manager to control a process's priority.

Priorities range from 0 to 31. By default, processes start with a priority of 7, which falls in the low-priority range. If you move an application to the foreground, Windows NT automatically boosts its priority to 15 or higher, which falls in the Realtime category.

Earlier, when we showed how to regulate your swap file, you may have noticed the Boost slide bar on the Performance tab of the System properties sheet, as shown in Figure G. This slide bar controls the priority of the application running in the foreground. If you're using Windows NT Workstation, we recommend setting the Boost level to Maximum, which gives the foreground application the highest reasonable amount of processor time. However, if you're running Windows NT Server, chances are that the foreground application is less important than the services the computer is providing to the attached users. If this is the case, you should consider setting the Boost level to None.


Figure G: Set the Boost slide bar to Maximum if you want the application running in the foreground to run at the highest possible speed.


In this article, we've shown how you can ratchet up your NT system's speed by adding memory and optimizing your hard disk. We also demonstrated how to make your applications more responsive by changing priorities for your processor's usage. By implementing some (or all) of these modifications, you'll turbo-charge your performance and enable your systems to work as never before.