You experience performance issues in applications and services when the system file cache consumes most of the physical RAM

Symptoms

You experience performance issues in applications and services in various versions of Windows XP, Windows Vista, Windows Server 2003, Windows Server 2008, and Windows Server 2008 R2. Additionally, you notice the following symptoms:
  • Available memory is almost exhausted.
  • The system file cache consumes most of the physical RAM.
  • There is a continuous and high volume of cached read requests to the hard disk.

Cause

Memory management in Microsoft Windows operating systems uses a demand-based algorithm. If any process requests and uses a large amount of memory, the size of the working set (the number of memory pages in the physical RAM) of the process increases. If these requests are continuous and unchecked, the working set of the process will grow to consume all the physical RAM. In this situation, the working sets for all the other processes are paged out to the hard disk. This behavior decreases the performance of applications and services because the memory pages are continuously written to the hard disk and read from the hard disk.

This behavior also applies to the working set of the system file cache. If there is a continuous and high volume of cached read requests from any process or from any driver, the working set size of the system file cache will grow to meet this demand. The system file cache consumes the physical RAM. Therefore, sufficient amounts of physical RAM are not available for other processes.

On 32-bit versions of Microsoft Windows operating systems earlier than Windows Vista, the working sets of the system file cache have a theoretical memory limit of less than 1 gigabyte (GB). The limitation of the virtual address range prevents the working sets of the system file cache from exhausting the physical RAM.

On 32-bit versions of Windows Vista operating systems, kernel resources are allocated dynamically. The working set of the system file cache increases to consume the virtual address range of the kernel mode at the expense of other kernel resources. The limitation of this memory range is less than 2 GB. If the computer has more than 2 GB of physical RAM, the cache cannot exhaust all the physical RAM. However, the cache can exhaust the virtual address space in the kernel. This can cause allocation failures for other kernel components.

On 64-bit versions of Windows operating systems, the size of the virtual address range is typically larger than the physical RAM. In this situation, the working set for the system file cache can increase to consume most of the physical RAM.

Workaround

To work around this issue, use the GetSystemFileCacheSize API function and the SetSystemFileCacheSize API function to set the maximum or minimum size value for the working sets of the system file cache. The use of these functions is the only supported method to restrict the consumption of physical memory by the system file cache.

The Microsoft Windows Dynamic Cache Service is a sample service that demonstrates one strategy to use these APIs to minimize the effects of this issue.

Installing and using the Microsoft Dynamic Cache Service does not cause the exclusion of support for Microsoft Windows. This service and its source code are provided as an example of how to use the Microsoft supported APIs to reduce the growth of the file system cache.


You can obtain the service and source code from the following Microsoft website:

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

The memory management algorithms in Windows 7 and Windows Server 2008 R2 operating systems were updated to address many file caching problems that were found in earlier versions of Windows. There are only certain unique situations in which you have to implement this service on computers that are running Windows 7 or Windows Server 2008 R2.

How to determine whether your system is affected

To determine whether your system is affected by this issue, install the SysInternals RamMap tool. You can obtain the tool from the following Windows Sysinternals website:


When you run the tool, select the Use Counts option. This displays several columns that show the current pattern of memory usage. Click the Active column to sort by the number of bytes used, and note the top usage directly under the total.

If the top use count is “Metafile,” and if a large part of available memory is being used, you are experiencing the System File Cache issue that is described in the "Symptoms" section. You can verify this by using Performance Monitor to monitor the Memory\System Cache Resident Bytes counter and see the cache grow continuously over time.

Figure 1. Example RamMap output in which the computer is experiencing the issue.



Figure 2. Example RamMap output in which the computer is not experiencing the issue.



If the Memory\System Cache Resident Bytes counter in Performance Monitor shows an upward trend over time, the computer is experiencing the issue, as shown in Figure 3.

Figure 3. Example Performance Monitor output in which the computer experiences the issue over time.

Restart requirements

You do not have to restart the computer when you install, uninstall, or use this service.
If you are you reading this article because you are working with a customer who believes that they are affected by this issue, follow these steps to help resolve the issue.
  1. Verify that the customer's RamMap output, perfmon, or poolmon data confirms that the System File Cache is consuming most of the physical RAM, as described earlier.
  2. To obtain the Windows Dynamic Cache Service:
    • For Windows Server 2008, it is available publicly here.
    • For Windows Server 2008 R2, it is currently only available within Microsoft here: http://toolbox/dyncache
  3. Some Dynamic Cache Registry settings are as follows:

    File servers, you might want to try 1GB.
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynCache\Parameters]
    "MaxSystemCacheMBytes"=dword:00000400
    "MinSystemCacheMBytes"=dword:00000064
    "SampleIntervalSecs"=dword:0000003c
    "CacheUpdateThresholdMBytes"=dword:00000064

    Exchange 2007, you might want to try 500 MB:
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynCache\Parameters]
    "MaxSystemCacheMBytes"=dword:000001F4
    "MinSystemCacheMBytes"=dword:00000064
    "SampleIntervalSecs"=dword:0000003c
    "CacheUpdateThresholdMBytes"=dword:00000064

    SQL 2005 and higher, in the past when working with SQL EE’s, have used 2GB:
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynCache\Parameters]
    "MaxSystemCacheMBytes"=dword:000007D0
    "MinSystemCacheMBytes"=dword:00000064
    "SampleIntervalSecs"=dword:0000003c
    "CacheUpdateThresholdMBytes"=dword:00000064

Additional Resources

Read Chapters 9 (Memory Management) and 10 (Cache Manager) of Windows Internals, the 5th Edition.

MEMORY MANAGEMENT (LARGE SYSTEM CACHE ISSUES) Blog Post

Slow Large File Copy Issues Blog Post

Memory Limits for Windows Releases

976618 You experience performance issues in applications and services when the system file cache consumes most of the physical RAM

918483 How to reduce paging of buffer pool memory in the 64-bit version of SQL Server

895932 Things to consider before you enable System cache mode in Windows XP

232271 How to Optimize Windows NT Server Using the Registry

837331 About Cache Manager in Windows Server 2003

http://technet2.microsoft.com/windowsserver/en/library/EFA621BD-A031-4461-9E72-59197A7507B61033.mspx

LargeSystemCache TechNet Topic

RamMap Blog Post
คุณสมบัติ

รหัสบทความ: 976618 - การตรวจสอบครั้งสุดท้าย: 26 ก.พ. 2014 - ฉบับแก้ไข: 1

คำติชม