1

At Is there a way to reset Windows file cache? we learnt how to use RamMap to free up the all-you-can-eat Windows file cache, which was nice.

Am I the only person to think that reducing cache sizes in Windows VMs is an obvious win? Most guest cache is a wasted resource. If you could put the cache on a diet, you could reduce guest memory allocations without increasing swapping.

So the question is, how do you get the equivalent of something like RAMMap Empty Standby List running as a scheduled process? RamMap doesn't take arguments other than for logging. A scheduled task to flush the cache would be crude, but better than having to accommodate a cache algorithm that was never designed, and that MS appears not to have bothered to adapt, for virtualization.

Other suggestions welcome.

7
  • Are you running out of resources?
    – Dave
    Apr 3, 2013 at 12:24
  • social.technet.microsoft.com/Forums/en-US/w7itproperf/thread/… There is a discussion there, and there were fixes made, but now the only thing I can find is for the server platform. Aparently the 64bit change is what allows the system cache to go over the 1Gig that it was back in 32bit systems. Lots of people are noticing that it doesnt help when it takes everything, even though it is always releaced when needed. The only real solution would be a control of the size.
    – Psycogeek
    Apr 3, 2013 at 12:36
  • Dont expect this to work , microsoft.com/en-us/download/details.aspx?id=9258 , the new dynamic cache service, but windows 7 is not listed :-( and it tosses error for many people . I Just want to lock the size at about 2-4Gig, I could bounty this question for a control the cache solution, but I would not bounty it for a repeating thrash the cache, because that isnt a solution before there was CacheSet too technet.microsoft.com/en-us/sysinternals/bb897561.aspx Again, dont expect it to work either.
    – Psycogeek
    Apr 3, 2013 at 14:12
  • Instead they are now pointing to this support.microsoft.com/kb/920739 and This support.microsoft.com/kb/2564236/EN-US Hotfixes for some of the things that fill the caches and didnt work with the cache properly.
    – Psycogeek
    Apr 3, 2013 at 14:14
  • These are good links, thank you. I am only running out of resources on the host. I am not trying to address a bug, just the greedy resource behaviour of an OS that assumes it is the only OS on the box. Dyncache looks like one answer although it is an extraordinarily ugly hack. Generally speaking, we need the functionality of RamMap's Empty menu in a command line tool.
    – antevansi
    Apr 3, 2013 at 16:49

2 Answers 2

0

After a bit of experimenting I'm getting best results by 1. starving guests of RAM and 2. caching guest I/O on the host.

For example, instead of running Win 7 64 with 2.5GB RAM and getting it to do its own caching, give it 1GB, plus at least 1GB of swap space, and switch on caching for the relevant virtual disk controller. I happen to be using VirtualBox which makes this easy.

This sounds inefficient but it seems to force a more conservative memory allocation regime by the guest, which leads to less (visible) waste. There is more swapping, but the swapping is cached, so its effect is diminished. Some data will be cached twice, but the amount is proportionately smaller because of the smaller guest cache (a couple of hundred MB instead of something approaching 1GB).

Overall this seems to be a better optimization strategy. When there are fewer guests, they get the benefit of a bigger host cache. When there are more, they are allocated more resources (cache) according to need, not according to a fixed, pessimistic memory allocation.

Overall conclusion: the virtual memory model is poorly adapted to hardware virtualization, and there hasn't been much effort to make it tunable or adaptable to running in a VM, at least by MSFT.

0

Some points to consider:

The Windows file cache (reactive, the one that uses file mapping, it's been there since NT 3.1) does not live on the standby page list. It used to be in the catch-all "system working set". As of Windows 7 that working set was broken up into four and the file cache is now in a working set of its own. In PerfMon it is the "System Cache Resident Bytes", and also "Cache Bytes", both under the Memory object. In RAMmap's "Use Counts" tab this is part of what's at the intersection of "active", "Mapped file". The "Empty system working set" feature in RAMmap flushes this working set (but it usually doesn't stay flushed for long).

The Windows file cache is normally only involved for small files (under a MB or so). Most programs use file mapping to access large files, and file mapping doesn't go through the Windows file cache (even though the cache uses file mapping on the files it does deal with).

Superfetch does use the standby page list, but it does not remove anything from, nor add anything to, the standby page list. It merely repurposes those pages. So getting rid of Superfetch (easily done by disabling its service) won't change the size of your standby page list. It merely will mean that low-priority pages on that list won't be repurposed for Superfetch. They will remain in use as a cache of pages recently pushed out of working sets during working set replacement.

You must log in to answer this question.

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