5

Many people ask how to disable pagefile, because they feel the effects of the issue I will ask about. Instead I want to fix the issue, without disabling pagefile.

Windows has the capability of storing on the pagefile RAM that it thinks it might need to page out, although theoretically this help avoid trashing in an emergency, it is deeply annoying to people with systems that have slow HDDs, for example cheap laptops.

For example my current computer: Right now it has 4.8gb of RAM in use, but has about 8gb of current "commit charge"

Using sysinternal tools, I find out that most of the content of page files, are preemptive copies of things in the RAM, that DO look it is low (I have 8gb of ram, thus it is 61% in use), but using RamMap I notice that most of the ram usage is "standby" memory, and most of that "standby" memory is windows cache (the one to make files load faster). with a huge chunk being a binary file that is the sound files of a game.

So, what currently happens: I play some game... windows load it on the RAM, and copy other things to pagefile (making game performance poor), then I stop playing, windows leave the game files cached on the RAM, since the RAM usage is high, it keeps putting more stuff on the pagefile, expecting me to run out of RAM, this make it slow, as it is constantly doing I/O in my extremely bad quality HDD.

But if I look only in the real RAM usage by apps, the commit charge of currently running apps, processes, kernel and shared things used, the real RAM usage should be 2.5gb, RAM and pagefile included.

So, I wanted to try instead of telling windows to not cache (the caching is kinda cool), or to disable pagefile, I wanted to tell it to NOT use the pagefile unless it really needs to (for example if physical ram usage - standby physical ram usage > 80% of physical ram).

Anyone know how I do that?

speeder
  • 380

3 Answers3

3

After lots of research, I learned that what I asked is literally impossible, you can't tweak Windows to behave better, the best that can be done, is literally disabling page file entirely.

Disabling page file mostly did the trick for me, fixing most of my performance problems (and causing a few other problems), but it was fully worth it.

speeder
  • 380
1

This will make performance worse, I'm afraid. As you concede, your disk is slow. This means that having as much memory as possible available for use as a disk cache is essential. This is only possible by removing things that are not being accessed from RAM, and that requires writing them out to the pagefile.

If Windows didn't use the pagefile to make more RAM for caching, even more disk I/O would be needed due to the reduced caching. That would make performance worse.

Windows is making the best of a bad situation. The folks who designed the Windows memory management system (from Vista on) knew exactly what they were doing and are leading experts in the design of paging systems on modern hardware. Neither you nor I know better than they do. They didn't do anything majorly wrong that can be fixed by flipping a switch. Sorry, there's no magic "go faster" button.

By the way, modern SSDs have significant write endurance. So if you can't add more RAM, adding a small, cheap SSD for your pagefile is not unreasonable. Obviously, keeping your main files on an SSD would make more of a difference.

1

Sadly you cannot do this, you basically can either have a pagefile, or not have one, you can choose where the pagefile is stored and how big it is, but you have no control over the algorithm of what gets swapped out.

I am sure you have had frustrating answers given to you as if you are an idiot and the Microsoft developers are always correct etc.

Basically windows is programmed to prefer standby memory (read cache) over keeping things out of the pagefile. The idea been that there is a chance you want to read data that is in the standby chache, and if that happens, you have a performance gain.

I dont quite agree with this, my opinion is, if you swapping live data out to a pagefile, it is "inevitable" your system will want to read that data at some point, and when it does, you will get lag, because its been read from the pagefile. In addition reads from page files have higher overheads vs reads directly from a filesystem.

On my system as an example windows will always page out Nvidia multi display power saver tool, I dont know why, something in the algorithm makes it pick on that app, it will get pages out even if ram utilisation is as low as 5%.

My opinion is that page files should only be used as disaster avoidance, basically akin to the swappiness=1 linux sysctl. Which is basically the same as what you were asking in your question essentially the only parts of ram usage in windows that are are important is "in use" and "modified", modified is the write cache, which obviously needs to dump its data to disk before it can be cleared, whilst clearing standby cache has no negative consequences.

I have done a fair amount of testing on my 32 gig windows system, and I have seen absolutely no evidence of performance gain from having the page file enabled, but I have seen performance loss as trying to use any app it chooses to page out suffers lag.

The clear answer I give to which way to go question, is if system stability is your prime aim, keep the page file enabled, and have it set to at least 8 gig in size. If performance is your goal, and especially if you have at least 32 gig of ram, then by all means disable the page file.

Chris C
  • 59