9

There is a machine, with a very fast RAID array, and a fast internet connection. But, it only got 8gb of mem, which runs out really quick, when the upload goes up.

Any ideas how could I disable, or limit the cache?
(I have tried disabling Write Cache from Device Manager. But that's just write cache, and it didn't help.)

2
  • Any relation to this? superuser.com/questions/415140/… May 8, 2012 at 20:26
  • @OliverSalzburg Sadly, it's not in standby now. Standby is great, and should be ON always. It's a good stuff. But now, for some reason, this ram gets used as "Active". (I'm using uTorrent to test the speeds, and under a fast transfer, it starts happening.)
    – Apache
    May 8, 2012 at 20:28

4 Answers 4

5

The whole point of the cache is that it uses unused ram, and gives it up as soon as an application requests more. Thus, you don't want to limit its size as doing so would just leave the free ram completely wasted.

4
  • 11
    Please tell that to my Windows 7, which swapped out all programs just to stuff a video file into the cache while encoding it - a file that will be read exactly once - and crashed the entire box. Jan 24, 2013 at 18:58
  • This may depend on the LargeSystemCache option. For whatever reason, I had it set (probably back from the time where the RAM I had was more than sufficient for everything I did). Jan 24, 2013 at 22:02
  • @JanSchejbal, that's the setting I could no longer remember due to the fact that I gave up on Windows a few years ago. Normally the kernel tries to swap out pages from processes that have been idle for some time because that memory can be better put to use caching files for active processes. That setting makes it more aggressive at this.
    – psusi
    Jan 25, 2013 at 4:39
  • @JanSchejbal the LargeSystemCache registry key is no longer used as of 2008r2 according to blogs.technet.com/b/askperf/archive/2008/02/01/… Aug 27, 2013 at 0:04
3

You have to call the system API SetSystemFileCacheSize()
Documented here: http://msdn.microsoft.com/en-us/library/aa965240.aspx

Some GUI programs allow it: http://technet.microsoft.com/en-us/sysinternals/bb897561
But you may prefer CLI, to automaticaly run it at system startup: http://www.uwe-sieber.de/ntcacheset_e.html (look in the middle of the page, it works for 2k8)

Or just write a powershell script calling SetSystemFileCacheSize()

Note it is strongly discouraged to disable the cache for production use.
It is frequent to limit the cache size to a small value for virtualized machines, not to disable it.

3
  • hmm... so far, so good! I'll report back soon.
    – Apache
    May 8, 2012 at 20:35
  • That's weird. I have set the working size MAXIMUM to 1 gigabyte, and it just makes it way through. It'll go much higher, it doesn't care about the value or limit. Why?
    – Apache
    May 8, 2012 at 20:45
  • You have to be sure to monitor the right value. Use the cacheset utility for that. May 9, 2012 at 13:37
2

We have also experienced this issue on Windows Server 2008 R2 in our company. In our case the machine got totally stuck. It seems to be a bug on this server version of Windows, because it did not occur under the same circumstances either on my much smaller Windows 7 machine running in VirtualBox, or under Linux.

You can set the cache to a certain limit with an API as others have already posted, but you can find applications to directly use it, such as SetSystemFileCacheSize.exe or NT Cache Setter.

The downside is that you need to set the cache after every reboot. You can also flush the whole cache in one go with this.

We set the file cache on our VM having 14 GB RAM to 4 GB and it works. Also flush works nicely and you can see it directly in Task Manager.

Command line samples:

  • Show the current Windows settings:

    SetSystemFileCacheSize.exe
    
  • Show help:

    SetSystemFileCacheSize.exe /?
    
  • Set the minimum size to 8 MB and the maximum size to 128 MB:

    SetSystemFileCacheSize.exe 8 128
    
  • Disable minimum size and set the maximum size to 128 MB:

    SetSystemFileCacheSize.exe off 128
    
  • Disable minimum and maximum size:

    SetSystemFileCacheSize.exe off off
    
  • Flush the file cache:

    SetSystemFileCacheSize.exe flush
    

Note: The tool must be started with admin privileges.

0

To limit the file cache, make sure that is not enabled the Maximum opcion of file sharing performance and you can specify the minimum amount of memory file cache by selecting Minimize memory used or Balance.

To check the current configuration go to: Start->Control Panel->Network Connections->Local Area Connection->On the General tab,Properties->Select File and Printer->Properties.. if the opcion Maximize is selected, then choose any other option.

1
  • The properties option is not avaliable for the Printer and File sharing. :) Anyway, it's turned off, the cache it is. Yet in Rammap, every single file are getting into the file list, and the Active memory just keeps growing and growing.
    – Apache
    May 8, 2012 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .