这个是很老旧的一个话题了,转载自(有改动):

http://adirectory.blog.com/2012/07/windows-2008-r2-memory-footprint/


Windows 2008 R2 内存问题。 OS是Windows 2008 R2 Standard版,Total 有12 G内存,从task manager 和Nagios监控看,内存基本上被吃光了,但是,把所有的process 占用的内存加起来,用了大概2G多,其它9G的内存不知道用到什么地方去了。

我使用RAMMAP的工具检查,发现这不见的9G内存时被Metafile占用了。请问一下这个Metafile 具体是指什么?如何解决?

 

回答:通过下面的三篇文章,让我们共同分析这个问题:

Introduction to the new Sysinternals tool: RAMMap

http://blogs.technet.com/b/askperf/archive/2010/08/13/introduction-to-the-new-sysinternals-tool-rammap.aspx

High Memory Usage – Windows Server 2008 R2 File Server

http://wasthatsohard.wordpress.com/2011/03/01/high-memory-usage-windows-server-2008-r2-file-server/

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

http://support.microsoft.com/kb/976618#appliesto

所以,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.

那么Metafile是系统缓存的一部分同时也包含了NTFS的数据。

其实对于这个Metafile占用内存的原理的话,一般都是因为在文件打开后为了快速查询和复制,服务器会考虑把这些文件放置到自己的内存里,那么如果文件被打开的或是查询的越多那么内存占用就会越多。


在上面提到的那个KB中,Microsoft提供了一个Microsoft Windows Dynamic Cache Service,这样的话可以用GetSystemFileCacheSize API 和 SetSystemFileCacheSize API去设置最大的内存使用率,

您可以从下面的网站下载Dynamic Cache Service

http://www.microsoft.com/en-us/download/details.aspx?id=9258

算是折中的方案,下载的Dynamic Cache Service提供了源代码和使用说明来修改GetSystemFileCacheSize和SetSystemFileCacheSize的数值。


其实定期安排服务器重启的话,有一定的改善作用;但是修改这个数值才是真的解决方法,因为这个问题是Known Issue。
Devin Zhang 

 

windows 2008 r2内存占用的相关文章请参考

虚拟内存设置 

32位windows 2008只认2G内存 

windows性能计数器Pages/sec 

—gnaw0725