转载微软的technet -Evaluating Memory and Cache Usage

http://technet.microsoft.com/library/Cc938590

This topic has not yet been rated - Rate this topic

Use the Performance console and other Microsoft® Windows® 2000 tools to assess available memory and to observe the effects of a memory shortage, a common cause of poor computer performance. Examine the effectiveness of the file system cache — an area of physical memory where recently used data read from or written to the disk is mapped for quick access. In addition, use Windows 2000 tools to investigate memory problems caused by applications that have not been optimized.

System.Char[]

Overview of Memory Monitoring

Determining the Amount of Installed Memory

Understanding Memory and the File System Cache

Optimizing Your Memory Configuration

Establishing a Baseline for Memory

Investigating Memory Problems

System.Char[]

Overview of Memory Monitoring

2 out of 3 rated this helpful - Rate this topic

Low memory conditions can slow the operation of applications and services on your computer and impact the performance of other resources in your system. For example, when your computer is low on memory, paging — that is, the process of moving virtual memory back and forth between physical memory and the disk — can be prolonged, resulting in more work for your disks. Because it involves reading and writing to disk, this paging activity might have to compete with whatever other disk transactions are being performed, intensifying a disk bottleneck (A disk bottleneck occurs when disk performance decreases to the extent that it affects overall system performance.) In turn, all this work by the disk can mean the processor is used less or is doing unnecessary work, processing numerous interrupts due to repeated page faults. (Page faults occur when the system cannot locate requested code or data in the physical memory available to the requesting process.) In the end, applications and services become less responsive.

Figure 6.1 illustrates the sequence in which you conduct the monitoring process. Memory has such an important influence on system performance that monitoring and analyzing memory usage is one of the first steps you take when assessing your system's performance.

Cc938579.FNEC01(en-us,TechNet.10).gif

Figure 6.1 Role of Memory Monitoring in Overall Monitoring Sequence

In the first phase of analyzing memory usage, you need to understand your current memory configuration and workload. To help you do this, use the steps in the following list:

  • Determine the amount of physical memory that is currently installed, and compare it against minimum operating system requirements.

  • Read "Understanding Memory and the File System Cache" in this chapter for information about the relationship between system memory and the file system cache.

  • Establish a baseline for memory usage on your computer by determining performance ranges for low or idle, average, and peak usage periods.

  • Optimize the system memory configuration to the system workload, including verifying cache and paging file sizes.

Focus subsequent monitoring on how your system uses memory and on identifying memory shortages or other problems, using the following steps:

  • Look at memory characteristics of processes using the Process\Working Set and Process\Private Bytes counters. The Working Set counter reports the amount of committed memory allocated to the process. This might include shared and private bytes currently resident in physical memory. The Private Bytes counter reports memory allocated exclusively to the process. Working set monitoring is important because, when memory is in short supply, the operating system trims the working sets of processes and paging occurs. (The working set of a process is the amount of physical memory assigned to that process by the operating system.)

  • Monitor the counters listed in "Investigating Disk Paging" later in this chapter to understand the relationship between the amount of paging and the amount of disk activity and their effect on overall performance. Excessive paging can burden the disk.

  • Determine the effectiveness of the file system cache. Your system performs better when it can find requested data in the cache, rather than when it must read from the disk.

  • Learn how to tune the workingsets of applications, if you have access to source code. Efficient applications maintain a small working set without generating page faults.

Determining the Amount of Installed Memory

This topic has not yet been rated - Rate this topic

Start your monitoring efforts knowing that you have at least the minimum amount of memory required to run Windows 2000. These requirements are as follows:

  • Microsoft® Windows® 2000 Professional: 32 megabytes (MB)

  • Microsoft® Windows® 2000 Server: 64 MB

The memory recommendation for Windows 2000 Professional is based on a typical desktop configuration including a business productivity application, such as a word processor or a spreadsheet program, an e-mail application, and a Web browser. The memory recommended for Windows 2000 Server is based on either a dedicated or a multiuse server with a low load, such as a small file-sharing and Web service configuration for a small office. If you are using a database management system such as Microsoft® SQL Server ™ or a messaging server such as Microsoft® Exchange, consult the documentation for those products to determine the memory recommended for running them on Windows 2000 Server.

There are a few different ways to determine the amount of memory on your computer. You can find the amount of physical memory installed on your system by clicking the Performance tab in Task Manager. Or you can find the amount of available RAM by double-clicking System in Control Panel and then clicking the General tab.

note-icon

Note

You can see the memory configuration on local or remote systems using System Information. For more information, see Windows 2000 Server Help.

The operating system distinguishes memory usage by applications and services depending on whether the usage involves the paged or the nonpaged pool. The paged pool contains memory for objects used by applications and services that can be paged to disk; objects in the nonpaged pool cannot be paged to disk. The operating system determines the size of each pool based on the amount of physical memory present. Memory pool usage can be an important factor in evaluating memory usage by your applications. For more information, see "Investigating User-Mode Memory Leaks" and "Investigating Kernel-Mode Memory Leaks" later in this chapter.

The file system cache, which is a subset of physical memory used for fast access to data, and the disk paging file, which supports virtual memory, influence the amount of memory used by the operating system and applications. (The disk paging file, also called a swap file, is a file on the hard disk that serves as temporary, virtual memory storage for code and data.) Virtual memory is the space on the hard disk that Windows 2000 uses as memory. For purposes of monitoring, the most important types of virtual memory are committed memory that the system sets aside for a process in the paging file and available memory that is not in use by a process. (Another type of memory managed by Windows 2000 is reserved memory, which the system sets aside for a process but which might not be entirely used.) The following sections describe the influence of the cache and the paging file on performance and explain how best to adjust these for optimal memory usage.

Understanding Memory and the File System Cache

2 out of 4 rated this helpful - Rate this topic

Windows 2000 allocates a portion of the virtual memory in your system to the file system cache. The file system cache is a subset of the memory system that retains recently used information for quick access. The size of the cache depends on the amount of physical memory installed and the memory required for applications. The operating system dynamically adjusts the size of the cache as needed, sharing memory optimally between process working sets and the system cache.

On computers running Windows 2000 Server, the value set for the LargeSystemCache registry entry in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management controls the size of the cache. You should set the value of the LargeSystemCache entry using the Windows 2000 Server user interface, rather than by editing the registry. Use the Server Optimization tab in the File and Printer Sharing for Microsoft Networks Properties dialog box to control memory buffer allocation for network connections and the size of the file system cache working set. Figure 6.2 illustrates the user interface for configuring these settings. Notice that these settings are not available on Windows 2000 Professional.

Cc938576.FNEC05(en-us,TechNet.10).gif

Figure 6.2 File and Printer Sharing for Microsoft Networks Properties Dialog Box

To view or change Server Optimization settings

  1. From the Start menu, point to Settings, and then click Control Panel.

  2. Double-click Network and Dial-up Connections.

  3. Double-click Local Area Connection, and then click the Properties button.

  4. In the Local Area Connection Properties dialog box, double-click File and Printer Sharing for Microsoft Networks.

  5. Under Optimization, if you are running Windows 2000 Server, the Maximize Data Throughput for File Sharing option is selected by default.

  6. Click OK.

The values for the LargeSystemCache entry are shown in Table 6.1, along with their corresponding options under File and Printer Sharing for Microsoft Networks Properties.

Table 6.1 Settings that Manage Cache Size in the Registry and the User Interface

Registry value

User interface option

Description

Notes

0

Maximize data throughput for network applications

Optimizes systems for distributed applications that typically do their own memory caching (such as SQL Server, which sets this option by default). This setting is useful for computers providing application services because it favors the working sets of processes over the working set of the file system cache.

This setting is useful for larger server applications and database servers such as SQL Server that need to maximize process working sets over the file system cache working set.

1

Maximize data throughput for file sharing

Optimizes the system for file and printer sharing resources. This is the default set by Windows 2000 Server Setup. If you have at least 128 MB of RAM, this value results in a very high maximum size for the cache working set.The Maximize Data Throughput for File Sharing option is useful for computers that typically run the Server service for file sharing.

On Windows 2000 the file system cache working set can be increased by 464 MB of additional virtual address space (up to 960 MB) if the system has less than 16 GB of RAM, is not configured to start with the /3GB Boot.ini switch, and the PagedPoolSize entry is set to a value other than 0xFFFFFFFF (or 0 on systems with more than 1 GB of RAM), such as 192000000, the system is not running Terminal Services, and the SystemPages entry is not set to 0xFFFFFFFF. For more information about how various memory-management registry entries interact, see "Optimizing Your Memory Configuration" later in this chapter.

To adjust the way memory is allocated on your system, you might want to tune the settings of the preceding registry entries under the Memory Management subkey. The following section describes how to do this.

Optimizing Your Memory Configuration

2 out of 3 rated this helpful - Rate this topic

The default memory-management settings for your system are optimal in most situations and do not need to be changed. However, the system can provide a much larger working set and additional virtual address space for the system cache if some settings are manually tuned. These settings include the following registry entries in the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management subkey:

  • LargeSystemCache. A value of 1 maximizes the size of the system cache's working set and, with PagedPoolSize set to 192000000 and SystemPages set to 0, provides a large virtual address space for the cache, provided that Terminal Services and the /3GB switch are not used. In addition, the maximum working set and large virtual address space for the file system cache are unavailable if Driver Verifier, a tool for testing kernel drivers, is enabled with the special pool. For information about Driver Verifier, see the Driver Development Kits link on the Web Resources page at http://windows.microsoft.com/windows2000/reskit/webresources.

  • PagedPoolSize. Changing this to 0xFFFFFFFF or leaving it at the default of 0 maximizes the size of the virtual address space used for the paged pool. To set aside extended virtual address space for the file system cache, change this value to 192000000, set LargeSystemCache to 1, and set SystemPages to 0.

  • SystemPages. Changing this to 0xFFFFFFFF provides an additional 464 MB of system page table entries for the virtual address space. Notice that making this change prevents expanding the system cache by 464 MB (limiting it to 512 MB) and limits the paged pool size to 192 MB, provided PagedPoolSize is not set to 0xFFFFFFFF to obtain the maximum virtual address space for the paged pool.

Notice that you have the option of changing the settings for LargeSystemCache in the user interface (using the Server Optimization tab in File and Printer Sharing for Microsoft Networks properties). However, you can only change the settings of SystemPages, PagedPoolSize, and NonPagedPoolSize using a registry editor.

caution-icon

Caution

Do not use a registry editor to edit the registry directly unless you have no alternative. The registry editors bypass the standard safeguards provided by administrative tools. These safeguards prevent you from entering conflicting settings or settings that are likely to degrade performance or damage your system. Editing the registry directly can have serious, unexpected consequences that can prevent the system from starting and require that you reinstall Windows 2000. To configure or customize Windows 2000, use the programs in Control Panel or Microsoft Management Console (MMC) whenever possible.

If you are using Terminal Services or your system is configured to start with the /3GB switch, these features consume the extra virtual address space that you might otherwise allocate to the system cache or the paged pool and that space is unavailable.

Do not change the SecondLevelDataCache entry
Some third-party sources have erroneously reported that modifying the SecondLevelDataCache registry entry in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Managementcan enhance system performance. The second level (L2) cache is recognized by the operating system and is fully utilized regardless of the setting of this parameter.

Establishing a Baseline for Memory

This topic has not yet been rated - Rate this topic

After determining that you have an adequate amount of physical memory and that your configuration is appropriate, examine your physical memory usage under a normal workload to establish a baseline or reference point for physical memory usage. The baseline is generally not a single value but a range within which physical memory usage can fluctuate and still provide acceptable performance. You can use the baseline to identify trends, such as increasing physical memory demands over time, or to recognize problems that arise from a sudden change.

To determine a baseline for your system, use the following counters to create logs of memory usage over an extended period (from several weeks to a month).

  • \Memory\Pages/sec

  • \Memory\Available Bytes

  • \Paging File(_Total)\% Usage

As you monitor the values of these counters, you might see occasional spikes. Typically, you can exclude these from your baseline because it is the consistent, repetitive values with which you are most concerned; the range of values that seem to appear consistently constitutes your baseline. When values fall outside of these ranges for extended periods, follow the instructions provided in this chapter to investigate the variations.

Investigating Memory Problems

This topic has not yet been rated - Rate this topic

After you have observed memory usage under normal conditions and established your memory baseline, you might notice that the memory counters sometimes stray from the typical range. The following sections describe how to investigate conditions that cause memory values to deviate from the baseline.

The following activities help you to learn about and analyze memory usage and memory bottlenecks using System Monitor counters and other tools.

  • Investigating memory shortages

  • Investigating disk paging

  • Investigating user-mode memory leaks

  • Investigating kernel-mode memory leaks

  • Monitoring the cache

  • Resolving memory and cache bottlenecks

Table 6.2 summarizes the most important counters to monitor for analyzing memory usage.

Table 6.2 Counters for Analyzing Memory Usage

To monitor for

Use this Object \ Counter

Memory shortages

Memory\Available Bytes or Available KBytes (to see the amount in kilobytes) or Available MBytes (to see the amount in megabytes)Process (All_processes)\Working SetMemory\Pages/secMemory\Cache Bytes

Frequent hard page faults

Memory\Pages/secProcess (All_processes) \Working Set Memory\Pages Input/sec Memory\Pages Output/sec

Excess paging with a disk bottleneck

Memory\Page Reads/secPhysical Disk\Avg. Disk Bytes/Read

Paging file fragmentation

PhysicalDisk\Split IOs\secPhysicalDisk\% Disk Read TimePhysicalDisk\Current Disk Queue LengthProcess\Handle Count

Memory leaks; memory-intensive applications

Memory\Pool Nonpaged AllocationsMemory\Pool Nonpaged BytesMemory\Pool Paged BytesProcess(process_name)\Pool Nonpaged BytesProcess(process_name)\Handle CountProcess(process_name)\Pool Paged BytesProcess(process_name)\Virtual BytesProcess(process_name)\Private Bytes

Cache Manager efficiency

Cache\Copy Read Hits %Cache\Copy Reads/secCache\Data Map Hits %Cache\Data Maps/secCache\MDL Read Hits %Cache\MDL Reads/secCache\Pin Read Hits %Cache\Pin Reads/secTo identify cache bottlenecks, also use Memory\Pages Input/sec with these counters.

important-icon

Important

The LogicalDisk object counters are not available by default. If you want to monitor the values for these counters, you must first activate the counters by typing diskperf yv at the Windows command prompt.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值