High Memory Usage – Windows Server 2008 R2 File Server
I recently reinstalled my file server on Windows Server 2008 R2 on VMware ESXi 4.1.1 and I noticed something very strange and very alarming. Couple hours after booting up, the server would use all of the physical memory as shown on the screenshots below.
By design, some services in 2008 R2 like Lsass.exe and dfs-replication will cache memory for future utilization. Exchange has the same behavior but on much bigger scale as it can eat all available memory. This cache is not a problem because the cached memory can be released and given to the OS or applications if needed be and doesn’t create any performance related issues. Note that this behavior is new to 2008 R2. In previous versions of Windows Server, you had to install Dynamic Cache Service to throttle the cache growth but it is no longer needed in the current version of Windows due to some kernel improvement. I then found a very useful tool from Sysinternals called RamMap. This tool creates a map of the memory allocated by the operating system.
This is where I found the cause of the “memory leak”. As per Technet ” Metafile is part of the system cache and consists of NTFS metadata. NTFS metadata includes the MFT as well as the other various NTFS metadata files (see How NTFS Works for more details, and of course Windows Internals is a great reference). In the MFT each file attribute record takes 1k and each file has at least one attribute record. Add to this the other NTFS metadata files and you can see why the Metafile category can grow quite large on servers with lots of files.” After adding 1 GB of RAM to my server, the Metafile stabilized to 1.5 GB of allocated memory.