I have a server which runs Windows Server 2008 R2 x64 with 4GB of RAM which hosts around 2-3 million files, the majority of which are image files.

Over a course of a week, I have noticed that applications on the server were slowing to a crawl due to excessive paging to the disk due to low memory, which has a knock-on effect to all services currently running on it, causing a major performance issue.

Upon investigation in Task Manager, I noticed that almost all 4GB was in-use but when you look in the Processes tab, the sum of all the memory usage there do not add up and at most only 1.5GB is supposed to be in use.

Using Google to find a solution, it appears that most of the RAM was used in the "Metafile" which is a cache of NTFS information for files on the file system so that the system does not have to query the MFT for information again. This cache is never cleared or marked as "cache" in Task Manager or as "Standby" in Sysinternal's RamMap.

There was a suggestion to install the KB979149 hotfix but upon trying to install it, it says "This update is not applicable to your computer".

The only temporary fixes I have so far found are:

  1. Use RAMmap from Sysinternals to "Empty System Working Set" every 1-3 days which marks the cache as "standby" and "cache" in Task Manager so the RAM can be used by other applications.
  2. Reboot the machine, which is undesirable as this server is serving public websites.

At the moment I am having to perform the 2. fix every few days to prevent it reaching bottleneck levels.

Before: (800MB RAM used - other applications cannot use this RAM)

After: (800MB RAM marked as cache - available for other applications)

So my question to you all is: Does any method exist out there to limit the RAM usage of this metafile?

link|improve this question
1  
4GB RAM on a server wich hosts 2-3 million files is absurd. Upgrade your RAM or upgrade your RAM. – pauska Oct 27 '11 at 12:04
1  
Never mind, CacheSet by Sysinternals lets me set the cache size, currently running this at intervals and doing so has solved the issue for me! – al2k4 Oct 27 '11 at 14:50
feedback

2 Answers

Sorry to be so direct but what about you upgrade the server to an amount of ram that is a little higher than a what workstations have these days? 16gb memroy are freaking cheap. Less expensive than even half a day of your time.

link|improve this answer
That would solve it for good but our servers are hosted remotely by a third party. Our hosts will charge a large sum just to increase the RAM on a monthly basis. So we would like to avoid that if possible. – al2k4 Oct 27 '11 at 11:09
Yeah. Guess what ;) This is why I buy my hardware. Hosts are crazy - you can buy the RAM in 3 months. Well, lessons to learn: an unprofessional setup comes back to bite you. – TomTom Oct 27 '11 at 11:34
feedback

I don't claim to be an expert regarding the internal workings of memory or disk caching in a Windows OS, but I have two observations:

  1. If the OS didn't cache the data in memory it would have to read it from disk, which is an exponentially slower storage media then memory, so the performance problem you're seeing now would almost certainly be worse.

  2. You're trying to solve the problem by treating a symptom of the problem instead of the cause of the problem. The cause of the problem is almost certainly a lack of sufficient physical RAM and my suggestion would be to address that.

In addition, while the cache may be using 1.5GB of RAM I would wonder what the memory usage is for other processes and services and might the solution be to investigate that usage for potential problems.

link|improve this answer
Exactly. If the OP reduced the RAM usage of the metafile, the system would have to load more metadata from disk since less of it would be in memory, making things worse. – David Schwartz Oct 27 '11 at 12:07
Thanks for the feedback. Few things, the server is primarily a web server with a MySQL database and does not read files very often so the slight impact of the metadata of not being in the cache is minimal, the performance increases dramatically when cleared. It is the number of different files it reads over time is why the cache size gets higher and higher. I am well aware that more RAM would solve it, but isn't the idea of a "cache" is to free up memory when applications or scripts on the server really need it to avoid paging? Why this certain cache is always marked as active confuses me. – al2k4 Oct 27 '11 at 13:14
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.