Working with a Windows RAMDisk
Consider these facts in today’s PC marketplace:
- Memory is dirt cheap (even fast memory goes for $4-5/GB in 8GB increments these days)
- Motherboards routinely accommodate 16GB of RAM or more (up to 64GB is typical for non-workstation rigs)
- Windows 7 or 8 will happily get by on 8GB of RAM, so it’s possible to treat anywhere from 8-56GB of RAM as “surplus”—fit for other uses
Then there’s one more truly “killer fact” to consider as well: The only form of storage faster than an SSD is a RAM disk, a boot-time storage facility that turns some portion of a computer’s RAM into an extremely fast form of disk storage. This storage comes with both pros and cons, and it’s important to remember that with SSDs going for $1-2/GB nowadays, a RAM disk also remains the only form of storage that’s still more expensive than an SSD (more than twice as expensive, in fact). But for those with a profound hankering for speed, and the budget to stock up on big memory modules, a RAM disk is at least worth considering as the next logical step when it comes to amping up PC performance.
How Much Faster Than an SSD Is a RAM Disk, Anyway?
Answering the question posed in the preceding heading forces me first to recite the following homily: “The answer to any good question always begins with the same two words—namely, ‘That depends[el]’” In the case of a system with a RAM disk, the speed difference between an SSD installed in that system and a RAM disk depends on:
- The speed of the disk interface to which the SSD is attached. Not all SATA controllers are alike, so even motherboards with different SATA 3 controllers will differ to some extent. Of course a motherboard with a SATA 3 controller will deliver better performance than one with a SATA 2 controller, even though neither will deliver anything close to the theoretical bus maximum (3.0Gbps for SATA 2, and 6.0Gbps for SATA 3).
- The speed of the SSD in use. SSDs come in many kinds, and some—even with reportedly identical characteristics—are faster than others. I routinely consult the Tom’s Hardware SSD Hierarchy Chart—last updated on 10/24/2012 as I write this story—to keep up with the latest and greatest SSD offerings.
- The speed of the RAM installed in the system. Not only are some motherboards endowed with faster memory buses than others, but also some motherboards can be overclocked more effectively than others, and also accommodate the high-end memory modules that can run fast enough to exploit such added speed. However, more and bigger memory modules are always more difficult to overclock effectively, so a RAM disk strategy works best if you rely on stock memory speeds and solid, stable big memory modules.
Table 1 - RAMDisk Test Systems
|
System 1 |
System 2 |
Motherboard |
Asus P6X58D-E Intel i7 930 3.2 GHz |
Asus P8Z68-V Pro Intel i7 2600K 3.4 GHz |
SATA type |
SATA 2 |
SATA 3 |
Memory |
6 x 4GB DDR3-10600 |
4 x 8GB DDR3-10600 |
SSD |
Intel 520 180 GB |
OCZ Vertex 3 120 GB |
The speed differences between the RAMDisk and the SSD are considerable on each system, though quite different. Figures 1 and 2 show the results of the CrystalDiskMark for RAMDisk and SSD on both systems, as the following captions relate.
Figure 1 System 1 Benchmark results: RAMDisk left, Intel SSD right
Figure 2 System 2 Benchmark results: RAMDisk left, OCZ SSD Right
The speed differentials shown are seriously surprising. System 1 shows a 15-fold speed-up for sequential read, and a 29-fold boost for sequential read. 512K reads jump 14-fold, writes 26-fold. 4K reads leap just over 10-fold, and writes 3-fold. 4K access with a queue depth of 32 improves by 260% for reads, and about 220% for writes. System 2 shows a nearly 13-fold speedup for sequential read and a 57-fold speed-up for sequential write! 512K reads again show a 13-fold speedup, and writes improve 45-fold. 4K reads show a 16-fold boost, and write jump 7-fold. 4K access with a queue depth of 32 improves by 240%, for both reads and writes.
What you can see in both cases is that the switch to a RAM disk can boost I/O performance considerably, sometimes by more than an order of magnitude. For those in search of speed, this is probably enough to justify adoption and use. Fortunately, it’s neither terribly expensive, nor terribly difficult to achieve.
Obtaining and Installing Dataram RAMDisk
A quick hop to the RAMDisk product page will enable you to purchase either a personal or commercial use license for RAMDisk in minutes. Subsequent to purchase, you’ll get a download link and license key via e-mail (you can also use the key to convert the free version to a full commercial version, if you’ve already downloaded same). An installation wizard drives the RAMDisk installation process, which takes less than five minutes to complete, as illustrated in Figures 3-9.
Figure 3 Double-clicking the installer file launches the RAMDisk Setup program.
Figure 4 Next, users must agree to the RAMDisk Usage and License Agreement.
Figure 5 Users must supply user name and organization information that agree with purchase data.
Figure 6 By default, the program goes into the 32-bit (x86) Program Files folder.
Figure 7 With minimal configuration complete, installation can be fired off.
Figure 8 A progress bar reports on installation progress (less than 60 seconds on both test machines).
Figure 9 Upon completion, the program indicates that RAMDisk is ready for use.
Post-Install Activities
Once the trivial task of installation is complete, the real work begins before you can make real use of RAMDisk’s capabilities. First, you must define and configure a RAMDisk for use, working through the RAMDisk Configuration Utility. The Settings tab for that program appears by default (see Figure 10).
Basic configuration parameters include disk size (the free version only supports up to 4GB, so you must purchase the program to create a larger RAMDisk), and partition types (see Figure 11). For larger RAM disks, it’s best to choose the “Unformatted” option, after which you can visit the built-in Windows Disk Management utility (diskmgmt.msc) to format the drive as NTFS, and assign a drive letter.
The Load/Save tab is where you define where to load your RAM disk image at startup, and where to save that image at shutdown (or whenever you manually use the Stop RAMDisk button to halt RAM disk operation when Windows keeps running). A Save Disk Image Now button also lets you save a RAM disk image to permanent storage whenever you like. The Event Log tab lets you scan the built-in Windows System Log to pull out RAMDisk related events (useful for troubleshooting, but otherwise not terribly informative). The Options tab provides control over timeout values, and lets you omit creating a backup file when saving a disk image, turn off compression on NTFS filesystems, or clear RAMDisk memory when you exit the program.
Basic configuration and setup is pretty easy, and takes no more than a couple of minutes to complete. I recommend that you consider your runtime memory needs carefully, and allocate no more RAM to a RAM disk than you can spare from other uses. On my 24GB i7 930 system, I set up an 8GB RAM disk; on my 32GB i7 2600K system, I went with a 12GB RAM disk instead. In each case, I decided to leave myself 4-8GB for OS runtime use, and the remainder (0-4GB on the 930, 8-12GB on the 2600K) for applications and virtual machines I typically run.
But Wait, There’s Still More to Do!
At this point, you’ve set up a RAM disk all right, but until you make some additional Windows system-level changes, you won’t be using the RAM disk to help speed up your PC. This requires tackling various tasks related to default storage locations that Windows normally targets at your system drive (that is, the drive where the Windows operating system resides, as stored in the %SystemDrive% environment variable).
The most common speed-ups applied with RAMDisk include:
- Retargeting the TMP and TEMP user variables to the RAMDisk device, as shown in Figure 12 (I labeled mine O: on my test systems; you can pick any unused drive letter you like as you set up your RAM disk). You can do this at the command line by typing SET TMP <target-spec> and SET TEMP <target-spec>, or use the System Properties item in Control Panel, Environment Variables to edit such changes instead.
- Visit the various web browsers you use, and reset their temporary files location to your RAM disk as well (see Figure 13). In IE, for example, this means clicking Tools, Internet Options, then clicking the Settings button under Browser History on the General tab. From there, use the Move Folder button to specify a location on your RAM disk. Similar techniques work for Chrome, Firefox, Safari, and so forth.
- If your RAMDisk is large enough, you can move some or all of your paging file to that drive. You’ll want to leave at least 2GB of paging file on the system disk, for mini crash dumps should your PC ever bluescreen, and you’ll probably have to experiment to find the right space allocation balance between your system drive and your RAM disk. Here’s what my current configuration looks like on my i7 930 PC (in the System Properties item in Control Panel, click Settings in the Performance pane, then click the Change button in the Virtual memory pane, to get to the window shown in Figure 14):
In general, any time an application allocates scratch or temporary storage for its own use, you can find a way in Windows to retarget the location to a RAM disk if you dig into its performance tweaking capabilities. On my own systems, I also retarget scratch storage for Windows Office applications, but that’s pretty much where my tweaking stops. You can take this effort as far as you like, and achieve some modest performance gains as a result.
Potential Gotchas
Using a RAM disk does come with some potential gotchas, about which readers must be aware. Because the RAM disk lives in volatile memory, if your system ever blue screens or freezes (forcing a manual reboot), you’ll lose the contents of virtual memory back to the most recent snapshot (most likely, the contents as of your last successful boot, unless you’ve manually saved RAM disk contents since then). This can be a little vexing, and will also affect MS Office applications’ abilities to auto-recover from failure (they store their working files in the temporary directories, which will be trashed whenever your system crashes for any reason). You must be prepared to accept this risk (“Save early, save often!” as the old mantra goes) to use a RAM disk without undue aggravation or regrets.
Also, whenever you turn off the RAMDisk, you’ll have to restore your temporary file settings to get most applications to work properly. That’s why it’s a good idea to keep a log of all your storage targeting resets (and the original values) so that you can put things back the way they were if you must turn off your RAM disk for any reason.
For Max Speed, RAM Disks Rule!
But if you want to squeeze the most oomph out of any system, as long as you can spare the RAM for storage—instead of runtime use for the OS, applications, or VMs—there’s no faster form of storage than a RAM disk. Use one well and wisely, and you’ll find yourself working in a snappier Windows environment. But be prepared to tweak and tune to get things right, and remember how to restore your runtime environment to original factory settings, so you can turn off the RAM disk and keep on running should you ever need to.