Understanding Memory Usage in Windows 2000
By John Sheesley for TechRepublic.com
As you evaluate and deploy Microsoft® Windows® 2000 Server and Windows 2000 Professional in your organization, you may be concerned about whether your machine is powerful enough to run Windows 2000 the way you want it to. One of the most important factors that impacts Windows 2000 performance is your computer's memory. In this article, I'll show you how Windows 2000 uses memory and how you can track memory usage to see how much you really need.
The items discussed in this article are equally valid whether you're using Windows 2000, Microsoft® Windows NT®, or Microsoft® Windows® 9x. Each of the operating systems makes use of memory in much the same way. However, some of the details, including Task Manager and Performance Monitor, are only applicable to Windows 2000 and Windows NT users.
On This Page
How Much Memory Do I Need?
Monitoring Memory Usage
Tracking Memory Usage with Performance Monitor
Fine-tuning Memory Usage
How Much Memory Do I Need?
As you may know, Microsoft requires that your computer have a minimum of 32 MB of RAM if you want to use Windows 2000 Professional, with a recommendation of 64 MB. If you want to use Windows 2000 Server, Microsoft requires a minimum of 64 MB with a recommendation of 128 MB.
Applications that you buy and install for your workstation or server also come with minimum requirements and recommended sizes. These requirements may leave you with a false sense of security when it comes to the amount of memory your computer needs to work well.
On the flip side, you may be tempted to buy as much memory as you can afford up front. Windows 2000 can support up to 4 GB of memory, so it may make sense to buy as much memory as your computer can support. However, blindly buying memory with no basis as to whether you need it can prove wasteful.
So how much memory do you need? The short answer is: It depends. Your memory requirements will vary depending on what you want your computer to do; for example, whether you want it to be a workstation, file server, or application server, and if you want it to perform many tasks at the same time.
You should take the vendor's recommendations into consideration as a baseline for deciding how much memory to add. You may want to double the recommendation just to make sure you have enough.
As you probably know, if you don't have enough memory in your computer, it will start running slower as it swaps information to swap files on its hard disk. In Windows 2000 terminology, these swap files are called "virtual memory."
As Windows 2000 swaps information to and from virtual memory, your computer must wait. This happens because your hard drive is much slower than direct RAM access. Not only do the disk swaps interrupt the CPU from processing data, they also prevent the disk from otherwise accessing files and data needed by you and your users. If the amount of RAM in your system is so low that your computer spends most of its time reading and writing to its virtual memory, it's not going to be very useful.
Fortunately, you can use several utilities that come with Windows 2000 to evaluate the amount of RAM you have in your system as it processes information, and you can find out how it uses its virtual memory.
Monitoring Memory Usage
Windows 2000 includes several different tools for tracking memory usage. These tools help you determine how Windows 2000 is using the memory in your computer and whether it's accessing virtual memory too much, resulting in bottlenecks. Two of the most common tools you can use to track memory usage include the Task Manager and Performance Monitor.
To monitor memory usage with the Task Manager, press CTRL+ALT+DEL and click Task Manager. When you do, the Task Manager dialog box will appear. Click the Performance tab, as shown in Figure A.
Figure A: You can monitor memory usage with Task Manager.
The Task Manager window contains eight panes. The CPU Usage, CPU Usage History, and Totals panes all deal with processor performance. The rest deal with memory usage. The areas are broken down as follows:
MEM Usage—This bar graph shows the amount of virtual memory your computer is using.
Memory Usage History—This line graph tracks the size of your virtual memory over time. It only displays the results; it doesn't actually record them anywhere.
Physical Memory Total—This number represents the total amount of RAM installed on your computer.
Physical Memory Available—This number shows the amount of RAM available for CPU processes. This number will never go to zero because the operating system will swap data to the hard disk as the memory fills.
Physical Memory System Cache—This is the amount of RAM being used by the file cache.
Commit Charge Total—This number shows the size of virtual memory in use. You'll notice that this number matches the number shown in MEM Usage.
Commit Charge Limit—This shows the size of your paging limit. The paging limit is the maximum size your virtual memory can be without making changes to its configuration.
Commit Charge Peak—This number shows the highest amount of virtual memory used since you began tracking usage.
Kernel Memory Total—This number shows the amount of paged and nonpaged memory used by the operating system's kernel. The kernel is the central core of the operating system that does most of the background work.
Kernel Memory Paged—This number shows the amount of virtual memory set aside for the kernel.
Kernel Memory Nonpaged—This is the amount of RAM dedicated to the operating system's kernel.
You can use Task Manager to perform a short-term evaluation of your memory usage. If you notice that the amount of virtual memory is vastly out of proportion to the amount of RAM in your system, you should increase the amount of memory in your computer. You may also choose to do a more long-term study of your computer's memory usage using Performance Monitor.
Tracking Memory Usage with Performance Monitor
Performance Monitor is a utility that can track many different items on your system. It can track such items as CPU usage, memory usage, I/O interrupts, and network interrupts. With Performance Monitor, you can get a long-term picture of how your computer works and where potential bottlenecks and problems may lie.
To start Performance Monitor, select Programs from the Start menu and click Administrative Tools. Click Performance. (In Windows NT, you'll click Performance Monitor.) When you do, you'll see the Performance Monitor dialog box, shown in Figure B.
Figure B: You can track memory usage over time with Performance Monitor.
Be aware that Performance Monitor follows Heisenberg's Uncertainty Principle: Performance Monitor itself will distort some of the things that you're trying to track. It doesn't have a large impact, but its reports about what's really going on inside your computer will still vary.
As you can see, Performance Monitor allows you to track many different items on your computer. The items that you can track using Performance Monitor are called "objects." Each object has individual properties that allow you to track in finer detail.
To select an object for tracking, click the Add button (+). When the Add screen appears, select an object to track from the Object drop-down list box. Then you must select a property of the object from the Performance Counters list box.
Finally, make a selection from the Instances list box. Instances refer to the processor and application thread you want to track. The best choice for most tracking purposes is TotalO#.
After you've chosen the instance to track, click Add. You'll see Performance Monitor begin to track the new object for you.
The two main objects you'll track using Performance Monitor are the Process and Memory objects. Some of the properties you'll track frequently include:
Memory: Available Bytes—This counter tracks how much physical memory remains after the working sets of running processes and the cache have taken what they need. If Memory: Available Bytes stays below the system-defined minimum level and the value for Memory: Pages/sec peaks continuously, you probably need to add memory to your computer.
Memory: Page faults/sec—Page faults happen when a program tries to use memory that's part of its working set and can't find it. Page faults come in two varieties: hard and soft. Hard page faults occur when the needed page must be loaded from the hard disk. Soft page faults happen when a program is found somewhere else in memory other than where the program expected to find it.
Memory: Page Reads/sec—This counter tracks the number of times the computer must look to virtual memory for pages. It doesn't count the number of pages, just the number of accesses.
Memory: Pages Input/sec—This counter enables you to track how many pages of memory the computer has to load from virtual memory.
Memory: Pages Output/sec—This counter helps you determine how many memory pages are being swapped out of the hard disk into virtual memory.
Memory: Pages/sec—Pages/sec reports the number of requested pages of memory needed to run applications that weren't available in RAM and that had to be read from or written to the hard disk to make room in RAM for other pages. If your system experiences a high rate of hard page faults, the value for Memory: Pages/sec will be high.
Process: Private Bytes—Private Bytes reports memory allocated exclusively to the process you're monitoring.
Process: Working Set—Working Set reports the amount of committed memory allocated to the process you've chosen. When your computer is running low on free RAM, working sets of processes—the amount of memory dedicated to the process—are trimmed and paging occurs.
As your computer uses more memory, you'll notice that the values for the virtual memory counters increase and stay at a high level. These values all indicate that you don't have enough memory in your system. If your system seems slow, but the counters don't indicate bottlenecks in memory, you may have other issues to deal with.
Where Did Administrative Tools Go?
After you install Windows 2000 Professional, if you try to run any of the programs from the Administrative Tools menu, such as Event Viewer or Performance Monitor, you may be in for a surprise. By default, Windows 2000 Professional doesn't display the Administrative Tools choice from the Programs menu. Here's how to change that:
Right-click your Taskbar, and select Properties. When the Taskbar Properties screen appears, click the Start Menu Options tab. At the bottom of the screen, you'll see the Start Menu Settings pane. Select the Display Administrative Tools check box. Then, click Apply and OK. You should now find Administrative Tools under Programs after you click the Start button.
Fine-tuning Memory Usage
After you've determined the amount of memory your system actually needs, you can fine-tune your server's memory usage based on your server's duties. Fine-tuning only works with Windows 2000 Server. It won't work with Windows 2000 Professional.
To fine-tune memory usage, right-click My Network Places and select Properties. When the Network Dial-up and Connections dialog box appears, right-click Local Area Connections and select Properties. You'll then see the Local Area Connection Properties screen.
Click File and Printer Sharing for Microsoft Networks in the Components pane of the Local Area Connection Properties screen, and click Properties. The File and Printer Sharing for Microsoft Networks Properties screen then appears, as shown in Figure C.
Figure C: You can fine-tune your computer's memory usage to match its duties.
Options you can choose from include:
Minimize Memory Used—This option offers maximum performance if you have fewer than ten workstations connected to your server.
Balance—This option offers maximum performance if you use NetBEUI (NetBIOS Enhanced User Interface) and have fewer than 64 workstations connected to your server.
Maximize Throughput for File Sharing—This option optimizes your server's memory when you typically use your server for file sharing in a large network.
Maximize Throughput for Network Applications—This option optimizes your server's memory for running server applications such as SQL Server or Microsoft Exchange.
As you can probably guess by the name, the Maximize Throughput for File Sharing option works best for servers that typically act as file servers only. That's because this setting reserves a large part of your computer's memory for caching, leaving it unavailable to applications. If you run any applications on your server such as Internet Information Server (IIS) or Microsoft Exchange, this setting can cause lots of swapping to and from the hard disk. If you want to run applications on your server, change the setting to Maximize Throughput for Network Applications to free this memory so that it's available for other components.
Microsoft Windows 2000 Server uses the Maximize Throughput for File Sharing option by default. Windows 2000 Professional defaults to Maximize Throughput for Network Applications. Select the optimization you want to use. When you're done, click OK and close the Local Area Connection Properties window.
These settings optimize the balance that Windows 2000 maintains for running applications or caching shared files. Windows 2000 uses part of your computer's memory as a file system cache to speed access to recently used data from your computer's hard disk. The size of the cache depends on the amount of physical memory installed and the memory required for applications.
Windows 2000 normally uses a maximum of 960 MB for the file cache when you select the Maximize Throughput for File Sharing option. If you use Terminal Server, Windows 2000 reduces the maximum available cache size. Windows 2000 dynamically adjusts the size of the cache as needed. You don't have to worry about making manual adjustments.
While you can't control the size of the cache, you can use Performance Monitor to track how effective the cache is. All you need to do is track the Cache object just like the Process and Memory objects mentioned above. If Performance Monitor shows that you have a large number of cache misses, or it shows times when the requested data isn't in cache and must be read from disk, then you may want to increase the amount of memory in your computer.
Alternatively, you can use the Minimize Memory Used option to reduce disk paging. You should only use this as a last resort. This option may leave the server short of memory to properly do what you want it to do. As a result, you may experience intermittent connection failures or errors when trying to connect to the server.
As a network administrator, part of your job is making sure your server is properly tuned to offer maximum performance for your users. One of the most important items that impact server performance is RAM. In this article, I showed you how Windows 2000 uses RAM and how you can monitor and tune its usage.
John Sheesley has been supporting networks since 1986 when he got his hands on NetWare 2.2. Since then, he's worked with the Jefferson County Police Department in Louisville, KY and Genlyte-Thomas Group. John's been a technical writer for several leading publishers including TechRepublic, The Cobb Group, and ZDJournals. John can be reached at firstname.lastname@example.org.
We at Microsoft Corporation hope that the information in this work is valuable to you. Your use of the information contained in this work, however, is at your sole risk. All information in this work is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Microsoft Corporation. Microsoft Corporation shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.