How to reduce disk thrashing (paging)?

Mark Russianovich has written a good long article on Virtual Memory,
Pushing the Limits of Windows: Virtual Memory

Virtual memory separates a program’s view of memory from the system’s physical memory, so an operating system decides when and if to store the program’s code and data in physical memory and when to store it in a file. The major advantage of virtual memory is that it allows more processes to execute concurrently than might otherwise fit in physical memory.

While virtual memory has limits that are related to physical memory limits, virtual memory has limits that derive from different sources and that are different depending on the consumer. For example, there are virtual memory limits that apply to individual processes that run applications, the operating system, and for the system as a whole. It's important to remember as you read this that virtual memory, as the name implies, has no direct connection with physical memory. Windows assigning the file cache a certain amount of virtual memory does not dictate how much file data it actually caches in physical memory; it can be any amount from none to more than the amount that's addressable via virtual memory.

It is a very good read.

How Big Should I Make the Paging File?
Perhaps one of the most commonly asked questions related to virtual memory is, how big should I make the paging file? There’s no end of ridiculous advice out on the web and in the newsstand magazines that cover Windows, and even Microsoft has published misleading recommendations. Almost all the suggestions are based on multiplying RAM size by some factor, with common values being 1.2, 1.5 and 2. Now that you understand the role that the paging file plays in defining a system’s commit limit and how processes contribute to the commit charge, you’re well positioned to see how useless such formulas truly are.


Earlier article: Pushing the Limits of Windows: Physical Memory

You can see physical memory layout with the Meminfo tool by Alex Ionescu.


Just leave the virtual memory management to Windows, it does a good job. Paging (and thus Mark Russinovic's blurbs regarding the matter) are rather irrelevant to disk thrashing (if you have system memory in abundance), you are looking for NTFS tweaks.

O'Reilly has an interesting article about NTFS Performance Hacks.

On the hardware side: a better hard drive with higher spin rate and larger cache will help a great deal too.

And here is how to kill the low memory warning, take ownership and nuke the following registry keys.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\ {5EE64AFB-398D-4edb-AF71-3B830219ABF7}]

and

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WDI\DiagnosticModules\ {45DE1EA9-10BC-4f96-9B21-4B6B83DBF476}]

This will prevent the Diagnostics Service from loading RADAR. It works for me in Windows Vista, the keys are present in Windows 7. I haven't tried it though - just backup those keys before you delete them.


The only way I've found was to increase RAM size to 8 GBs and turn off paging by setting

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Memory Management\DisablePagingExecutive=1

(reboot required).

That reduced disk activity to nearly zero.