Experiments with Ramdisk

 

So after looking into RAMDISK as an awesome way to get hyper fast workspace, I began to realize what the issues were with modern day RAMDISK and why it is that it’s not very popular.

 

First let’s make a ramdisk. Easy enough, OS X is unix based, so let’s just map some RAM off to a device. Then format and mount it. The process it outlined here:

http://osxdaily.com/2007/03/23/create-a-ram-disk-in-mac-os-x/

 

Next let’s do a few speed tests. First, a standard SATA 7200RPM drive (seagate) nothing fancy, but no slow poke either.

 

 

Sure enough, the results are as expected. Sequential writes are decent, averaging out at about 35MB/sec. Random writes are weaker though, due to the mechanical nature of the drive.

 

 

Next let’s take a look at the RAMDISK. We begin to start measuring things in GB/sec here. Scores of 1336 on an XBench test are pretty insane. Overall, just plain incredible.

 

So what can we use this in the real world?

 

1. High bandwidth video capture or rendering:

Sounds intriguing, as reading or writing to disk large HD files can be difficult on traditional HDDs.

2. Use as a photo storage while photoshopping

Would offer rapid access to all your images while loading.

3. Large file transfer over network etc.

If the bottleneck is the disk like I insist it is, then file transfers should be exactly 1.0GBps – overhead

 

So what happens really?

 

1. In video application, the problem lies within the size of the Ramdisk. While if you had a large capacity for storage of video captures or render, your’e still limited in terms of capacity. If you’re working with a video that is smaller than 1-2GB in footage or render size, then chances are the render times won’t be too terrible, that is, assuming you’re not doing anything intensive. However most applications who are working with large intensive files are going to load them into RAM first anyway and then work with them, especially if you have the memory to spare that you’re making ramdisks in the first place. So really, there’s no advantage there.

 

2. Next, we have a similar roadblock here. Photoshop loads your images into RAM anyway so by loading all your work files into a ramdisk, then opening them, they might load quickly into the application, but you’re better off ejecting the ramdisk and letting photoshop use the memory itself once everything is opened, which is really just a waste of time.

 

3. On the other hand, large file transfers seem to be quite good. I was able to transfer a 653MB TOD over SMB, gigabit, jumbo frames from jQuad ramdisk to MacBook ramdisk in 10 seconds flat. That’s about 65.4MB/sec. That’s about 0.5Gbps. I’m sure if I did some better tests with HTTP and other protocols, doing multiple tests I’d get a better result of .6 or .7, but overall it was quite impressive. In comparison, HDD to HDD did so in about 22.5 seconds, which is about 0.2Gbps. Pretty impressive increase.

 

But after considerable thought, it’s virtual memory and intelligent applications that killed the ramdisk. Before the time of virtual memory, (and system 7 and 8

didn’t have it as I recall) your system basically would have to use memory as carefully as possible, because once it was full, you basically were told to close applications and try whatever you wanted to do again. (If you want to experience such nostalgia, disable page file in Windows, it’s a party and a half) but nowadays the operating system just writes out to disk any memory that isn’t going to be in use (such as background applications) so that it can be given to the application at hand. Because applications can now use just about as much memory as they want, they do. Most applications now will simply load the entire file into RAM and work with it from there. As a result, it’s really only the initial load into the application that the hard disk is penalizing your speed.

 

Now one of the other downsides of virtual memory and it’s effect on ramdisk performance is that once another applications starts to request more memory that is currently available, the system will start to write memory to disk to offer it to the application. In this case, RAMdisk is not actually clear from this dumping to disk, and so if Photoshop decides to use more memory, then the system will simply write out your ramdisk the hard drive, and all of the sudden your hyper-fast temporary space is back on the disk and not so speedy anymore (that is, until it is restored to memory.)

 

All these factors contributed to the ultimate demise of ramdisk on the consumer desktop. While it’s still very useful for nimble linux live discs and to my knowledge Google uses it extensively in their server technologies, ramdisk will most likely stay a benchmark dream rather than a useful tool for high performance computing.