Performance degradation occurs in the UnmapViewOfFile function (815227)



The information in this article applies to:

  • Microsoft Windows Server 2003, Datacenter Edition
  • Microsoft Windows Server 2003, Enterprise Edition
  • Microsoft Windows Server 2003, Standard Edition
  • Microsoft Windows Server 2003, Web Edition
  • Microsoft Windows XP Home Edition SP1
  • Microsoft Windows XP Professional SP1

SYMPTOMS

A program that uses mapped file views that are larger than 500 megabytes (MB) may experience a significant performance decrease. Mapped file views are frequently used to share information between two or more processes. The performance degradation occurs in the UnmapViewOfFile function.

CAUSE

This problem occurs if a program maps file views that are larger than 500 MB in Microsoft Windows Server 2003 or in Microsoft Windows XP Service Pack 1 (SP1).

RESOLUTION

Windows XP Service Pack 1

Service pack information

To resolve this problem, obtain the latest service pack for Windows XP. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

322389 How to obtain the latest Windows XP service pack

Hotfix information

A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Windows XP service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time      Version        Size       File name     Platform 
   ----------------------------------------------------------------------- 
   28-Feb-2003  16:17    5.1.2600.1178   1,895,424  Ntkrnlmp.exe  i386 
   28-Feb-2003  16:17    5.1.2600.1178   1,951,232  Ntkrnlpa.exe  i386 
   28-Feb-2003  16:17    5.1.2600.1178   1,923,584  Ntkrpamp.exe  i386 
   28-Feb-2003  16:17    5.1.2600.1178   1,927,424  Ntoskrnl.exe  i386 
   28-Feb-2003  16:17    5.1.2600.1178   5,826,432  Ntkrnlmp.exe  ia-64 
   28-Feb-2003  16:17    5.1.2600.1178   5,736,704  Ntoskrnl.exe  ia-64

Windows Server 2003

Although the problem manifests with a call to the UnmapViewOfFile function, the required code change is deep within the kernel. Because of the risk of changing core memory management functions, a hotfix for Windows Server 2003 will not be available. The code fix for Windows Server 2003 will be available in Windows Server 2003 Service Pack 1.

Programs that could be affected by this problem can be identified by using Performance Monitor. To do this, follow these steps:
  1. Create a performance monitor log by following the steps that are described in Microsoft Knowledge Base article 248345 or by using the Performance Monitor Wizard.
    For more information, click the following article number to view the article in the Microsoft Knowledge Base:

    248345 How to create a log using System Monitor in Windows

  2. Log server activity during busy times.
  3. Stop the performance monitor log and review Working Set Size Peak under the Process performance object. Find any process where the working set size has exceeded 500 MB.
  4. Subtract the working set size value of each process that you identified in step 3 from the corresponding Private Bytes entry under the Process performance object.
If the working set for a process is 500 MB more than the private bytes, the program could be using large mapped views of files and could be affected by the performance degradation from calling the UnmapViewOfFile function. If these programs are randomly not responding or are unresponsive for long periods of time, debugging analysis or code review may be needed to verify that the programs are affected by this issue.

If the program is affected by this performance issue, the following coding workarounds are available for Windows Server 2003 until Windows Server 2003 Service Pack 1 is available:
  1. Remove calls to the UnmapViewOfFile function in programs that run in Windows Server 2003. This function call is necessary only if the process must map multiple sections of memory to the same memory address. The operating system will clean up the shared sections as soon as the last thread has exited.
  2. If you must call the UnmapViewViewOfFile function, write a new program to create a job object (CreateJobObject). Use the SetInformationJobObject function to set the maximum working set size to approximately 500 MB by setting the MaximumWorkingSetSize property in the _JOBOBJECT_BASIC_LIMIT_INFORMATION parameter. (This setting is 24 MB with the /3GB switch.) Associate all the required processes with this job object.
This program should be run after the required processes have already started. If one of those processes restarts, this program must be rerun. You may not incur a huge performance penalty if you limit the working set size for the process. If there is lots of available RAM on the system, the pages that are removed from the process's working set will be put on the standby list. If a page fault is incurred, it will probably be serviced by the page on the standby list in physical memory. Performance benchmarks should be run to determine the actual performance effect for this workaround.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in Microsoft Windows XP Service Pack 2. The problem is scheduled to be fixed in Windows Server 2003 Service Pack 1.

Modification Type:MinorLast Reviewed:11/21/2005
Keywords:kbHotfixServer kbQFE kbWinXPsp2fix kbtshoot kbenv kbQFE kbWinXPpreSP2fix kbfix kbbug KB815227