How to determine if a RAMDisk will be benificial and what to put on it?

How much RAM is necessary for a RAMDisk and how does one determine how much to allocate? Also what programs benefit from being put on a RAMDisk since the contents is lost when the machine is powered off? I was thinking of putting some Microsoft Office products on the RAMDisk, for example Word, Since the user always chooses where the documents are saved. I heard on Windows 7 RAMDisk is obsolete since SuperFetch does it job, is it as simple as that?


Solution 1:

(Forward: This post is written from a performance perspective. Ultrasawblade brings up a good point about the use of RAM disks to keep files from ever being written to disk for security reasons, and this post does not apply to those situations.)

It is as simple as that, and has been since before Windows XP. There is absolutely no need for a RAM disk in Windows 7, and very little need in Windows XP/Vista (these don't have SuperFetch which pre-fetches data, but they do have disk caching):

enter image description here

Standby memory (dark blue bar) is this disk cache. Windows will automatically manage it such that it fills as much RAM as it can without causing problems. It will dynamically shrink when applications need the memory, and grow when applications don't need the memory.

Every major OS has had disk caching for years. The only really new thing with SuperFetch is that it can guess ahead of time which blocks you might need, and copy them to the disk cache before you use them.

To get an idea of how effective disk caching is, in a 72-hour timeframe, applications on my desktop request about 5TB of data; however, 97.5% of that is served from a 32GB disk cache-- That means that only 160GB of data was actually read from the disk. (note, the above image is not from my desktop)

There is absolutely NO WAY I could manually select 32GB of data and have it cover 97.5% of the data requested by all applications on my system, including the kernel and services.


The only benefit to a RAM disk is that you get to choose which files are loaded ahead of time; You can load office onto it, and then office will load really fast. This is what is most frequently deceiving about RAM disks being "faster".

However, that comes at a very high cost. Loading all of office onto a RAM disk wastes a lot of memory: There are many files which are installed with office, but which are never used in normal use (templates, help files, themes other than the default, etc.). These are now wasting precious memory that could otherwise be used to cache files that you are using frequently. Or even parts of files. With a RAM disk, there's no way to cache something like the windows event log or the master ntfs file table. These both can be used hundreds of times per second in normal scenarios.

Disk caching is so powerful that you can't even turn it off in Windows; I honestly wish you could, just so that I could show people what it's like if they replace their disk cache with a RAM disk.

Solution 2:

  • Most RAMDisk software I've encountered lets you allocate any amount of RAM you want. So the amount you allocate is according to your needs and what you want to put on it.

  • RAM disks will speed up file access. With executables, the usual situation is that they are loaded and then not accessed anymore. Putting programs on there may not see much benefit other than initial start up time, unless your program has a lot of .DLL's that are always switched in and out - with typical PC memory being in the 4GB+ range this is not likely worth worrying about. Putting files the programs work with may see some speed increase.

  • SuperFetch preloads parts of programs that you use often in order to make programs launch quicker. If you are trying to make programs launch quicker with a RAMDisk, I believe SuperFetch would eventually do as good as a job once it learns what you use all the time. Note that RAM disks are volatile and you would have to recopy files each boot.

  • Windows caches bits of files in RAM not in use by programs. Trying to do this yourself with a RAM disk may not result in much improvement unless you A) have a specific program that reads and writes a file repeatedly, B) have no need for this file to exist on disk, and C) the program cannot be reconfigured in any other way. So it's a bit of a "hack" maybe to get an older program acting better, though I can't think of a specific example. Note that having a RAM disk reduces your available RAM to the system and other programs so you might be "robbing Peter to pay Paul" with your RAM.

  • One good use of RAM disks is to tell a program to write there in order to ensure that the data never touches a disk. Setting a program to use a temp directory on a RAM drive keeps that data off of a disk if security or privacy are extreme concerns.

Solution 3:

@ultrasawblade and @darthandroid have are correct. However, I want to boil it down even more. The best use of a RAM disk is to hold files that are frequently accessed - especially writing. Applications like Visual Studio, Adobe Creative Suites (temp file location), and games can benefit greatly from RAM disks.

As for SuperFetch, it is not a replacement for a RAM disk. SuperFetch uses an algorithm to place files in its cache. SuperFetch can "miss" a file. A RAM disk will never miss a file since all the files are copied to RAM.