Performance degrades when accessing large files with FILE_FLAG_RANDOM_ACCESS

Operating system performance may degrade when one or more processes access multiple large files using the CreateFile() API and the FILE_FLAG_RANDOM_ACCESS flag. The performance degradation is due to the system cache consuming available memory (visible in the performance counter Memory\Cache Bytes).
The FILE_FLAG_RANDOM_ACCESS flag is a hint to the Cache Manager that the file will be opened for random I/O. Random I/O means there is no predictable pattern to the I/O that will take place. This flag disables intelligent read-aheads and prevents automatic unmapping of views after pages are read to minimize mapping/unmapping when the process revisits that part of the file. This keeps previously read views in the Cache Manager working set. However, if the cumulative size of the accessed files exceeds physical memory, keeping so many views in the Cache Manager working set may be detrimental to overall operating system performance because it can consume a large amount of physical RAM.
Remove the FILE_FLAG_RANDOM_ACCESS flag when the application opens the file(s) with CreateFile. This will allows the views to be unmapped and moved to the standby list after page reads are completed. This will require involvement from the software developer.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Article ID: 2549369 - Last Review: 05/23/2011 18:57:00 - Revision: 1.0

Windows Server 2008 Datacenter, Windows Server 2008 Enterprise, Windows Server 2008 Standard, Windows Server 2008 R2 Datacenter, Windows Server 2008 R2 Enterprise, Windows Server 2008 R2 Standard

  • KB2549369