Monday, May 28, 2012

Ramdisk vs SSD on Ubuntu

With the advent of fast SSDs capable of reading/writing 200-500 Mb a second, is there a need for ramdisks?  I decided to try it out in Ubuntu 12.04.

If you are wondering what a ramdisk is, it  is simply using your physical RAM memory as a temporary storage drive. Instead of writing to disk, you are writing files to memory.

And the results of my testing?

Well, I'll let these pictures speak for themselves:

1st. Ramdisk.  Average read 1.2Gb/s. As in Gigabytes per second. An entire full DVD movie worth of data would take less than 5 seconds to copy.


2nd,Corsair F120 Sandforce based SSD. Read speed bench at 234 Mb/s which is no slouch and faster than any platter drive.  The same DVD would take roughly 22 seconds.


Compared to a standard platter HDD drive, a DVD would take  81 seconds at 60Mb/sec. A 10Mb/sec USB stick would take  486 seconds or 8 minutes to copy.
  
I tried a Virtual Box VDI image in ramdisk and an ubuntu 10.10 image loaded in less than 6 seconds.

Here is how you make a ramdisk:

 mkdir -p /tmp/ramdisk  
 sudo mount -t tmpfs -o size=1024M tmpfs /tmp/ramdisk  


Or, you can simply copy files to /dev/shm/ but you risk saturating all your available ram. By using tmpfs, you can set a limit. In my example, my ramdisk is 1GB.

It should be noted that ramdisks are not persistent. They will need to be recreated upon reboot. You lose the data in ramdisk when your power down.

I am currently exploring options for a real-time ffmpeg transcoding system that will write and read quite a bit to disk. I also have another use case scenario with imagemagick/ghostscript writing large temp files of PDFs. A ramdisk may be the way to go.

There is another interesting use of ramdisk. To run a completely private and secure micro servers like tor-ramdisk to evade police authority. Data would simply disappear upon a power down. If the authority seized your equipment, all the data would simply vanish and make it harder  for forensic analysis.

Now, I just need a laptop with 32GB of RAM.


No comments:

Post a Comment