Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2008 R2 / Fixing High Memory Usage by Metafile on Windows Server 2008 R2

July 25, 2016 Windows Server 2008 R2

Fixing High Memory Usage by Metafile on Windows Server 2008 R2

One of the file servers running Windows Server 2008 R2 encountered a problem of high RAM load resulting in the issues with the server and applications performance. It turned out that the memory was swamped by the system file cache containing file system metadata. The problem potentially affects all file servers with large numbers of files that are accessed by users. It is the most critical for x64 Windows versions, in which the size of the metadata file in the memory can enlarge almost to the whole size of RAM.

Contents:
  • High RAM Load on Windows File Server
  • What is a Metafile in Windows?
  • How to Quickly Clean Up metafile
  • Dynamic Cache Service to Manage the File Cache

High RAM Load on Windows File Server

The problem manifests itself as follows: in the Task Manager we see that physical memory is busy by 95-99%.

High Memory Usage on Windows 2008 R2 File Server

In the Processes tab, there is no any leaked process with abnormally high memory consumption. Moreover, if you sum the approximate values of memory used by all processes you won’t even get 50% of physical memory you have on your server. What is eating the memory then?

task manager process

The actual data on RAM usage can be obtained with the help of small utility –  RAMMap (by Mark Russinovich). Download the archive containing the tool and run RAMMap.exe with the administrator privileges. In the Use Counts tab, we see that Metafile is using the largest amount of RAM. (In our case, it is using 11 from 25 GB of the server RAM).

metafile size in rammap utility

What is a Metafile in Windows?

A metafile is a part of the system cache containing NTFS metadata and used to increase the performance of the file system when accessing files. NTFS metadata include the data of MFT (Master File Table). For each file or folder, accessed by the users, a corresponding block of at least 1 KB (the record of an attribute of each file is 1 KB, and each file has at least one attribute) is created in the metafile. Thus, on file servers with a large number of files, the metafile size (NTFS cache) may exceed several tens of gigabytes.

It is impossible to disable this cache or manage it using built-in Windows tools. As a solution, you can increase the size of the memory on the server, but it is not always possible.

To free up memory, you can restart the server, but in some time the size of the metafile in the memory starts growing incredibly.

For example, you can estimate the size of the MFT using another tool by Russinovich – ntfsinfo. In our case, the size of the MFT on a 2 TB disk is 13 GB.

ntfsinfo  mft size on disk

How to Quickly Clean Up metafile

RAMMap allows to quickly clear the used memory from MFT garbage without server restart. To do it, select Empty -> Empty System Working Set in the menu.

RAMMap Empty System Working Set

After that, the size of the metafile in the memory reduced dozens of times, and the percentage of RAM use by CPU dropped from 95% to 26%.

low_memory_usage

The main disadvantage of this method is that the clearing is manual and cannot be done automatically.

Dynamic Cache Service to Manage the File Cache

Another, more cardinal, solution of high memory load by the file system metafile is the installation of Dynamic Cache Service (http://www.microsoft.com/en-us/download/details.aspx?id=9258). This service allows to manage the parameters of the dedicated MFT cache using system APIs.

Important. Use this solution only if the problem described above occurs. The installation of this service won’t be a universal solution for other causes of high memory usage on your servers.

It is rather easy to install DynCache (there are detailed instructions in the archive).

  • Copy the file DynCache.exe to %SystemRoot%\System32 folder
  • Create DynCache service using this command: sc create DynCache binpath= %SystemRoot%\System32\DynCache.exe start= auto type= own DisplayName= "Dynamic Cache Service" install DynCache service
  • Import DynCache.reg to the registry (it contains default values)
  • Change the values of the following register keys: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DynCache\Parameters
    1. MaxSystemCacheMBytes: 4096  (dec) – the maximum cache size(Mb)
    2. MinSystemCacheMBytes: 100 (dec) – the minimum cache size (MB)MaxSystemCacheMBytes

    Note. These and other DynCache service settings have to be edited according to the RAM size, the server load, required performance, etc. As a rule, it is not recommended to set the cache size more than half of the physical RAM installed on the server. After the changes are made, you don’t need to restart DynCache, since all changes are applied dynamically.
  • Run the service using this command: sc start DynCache

In our case, after DynCache service had been installed, the use of memory by the metafile stopped getting over 4 GB we had set. The users have not reported any performance issues on the file server.

1 comment
3
Facebook Twitter Google + Pinterest
previous post
How to Install and Configure TFTP Server and Client on Windows
next post
Run MySQL Queries from PowerShell

Related Reading

Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

May 16, 2023

0x80244010 Exceeded Max Server Round Trips: Windows Update...

April 12, 2023

How to Enable TLS 1.2 on Windows

January 18, 2023

Outlook: Your Server Does Not Support the Connection...

October 20, 2022

Adding USB 3.0 and NVMe Drivers to Windows...

September 7, 2022

1 comment

FazzaGBR May 24, 2020 - 12:30 pm

Followed the instructions (there are multiple DynCache.exe in the extracted files so this could be the issue) but I get a 193 error when trying to start the service. Doesn’t work.

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Remote Desktop Connection Error: Outdated entry in the DNS cache
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top