17 comments

[ 3.1 ms ] story [ 34.7 ms ] thread
In FreeBSD, you can create a RAM Disk by doing:

mkdir -p /mnt/ramdisk

/sbin/mdmfs -s 256M md10 /mnt/ramdisk

For OS X, you can create a RAM disk like so:

  diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://1165430`
ex:

  Initialized /dev/rdisk4 as a 569 MB HFS Plus volume
works for me in firefox. but doesn't really seem faster, probably because my main disk is an ssd raid array.

http://dl.dropbox.com/u/186198/Screenshots/7k4b.png

I tried doing that and got this message:

    Usage:  diskutil eraseVolume format name MountPoint|DiskIdentifier|DeviceNode
    Completely erase an existing volume.  Ownership of the affected disk is
    required.  Format is the specific filesystem name you want to erase it as
    (HFS+, etc.).  Name is the (new) volume name (subject to filesystem naming
    restrictions), or can be specified as %noformat% to skip initialization
    (newfs).  You cannot erase the boot volume.
    Example: diskutil eraseVolume JHFS+ UntitledHFS /Volumes/SomeDisk
Edit: I got it to work by doing hdiutil attach -nomount ram://1165430 on one line, then diskutil eraseVolume on the newly mounted volume.
I've heard just increasing the size of the cache can have noticeable impact. So much so that they're going to increase the default (or maybe already have in the latest versions).
If you have a lot of tabs open this may not be a good idea. The OS may end up paging more often - especially when switching to and from the browser. This causes uncomfortable wait times while the harddisk thrashes.
Right - I'm skeptical that using a RAM disk like this has a benefit on any current OS.

The idea of a RAM disk being quicker than a real disk -- when memory is backed by the file system, and the file system has a cache in front of it -- sounds a lot like 1975 programming: http://www.varnish-cache.org/trac/wiki/ArchitectNotes

If you're manually managing your ram, then something is very broken.
Can someone explain why a Ram Disk has any advantage over cache based disk?
Most ramdisks map memory non-pageable. So, no matter how long those files have been sitting around, they will still be memory-resident, even long past the the time the files would either be not in the on-disk cache or still held in memory by the OS cache manager.
I'm not sure 20% is worth the hassle, to be honest. I did an experiment like this recently with our project compilation. Our project's pretty big, 875k LOC Java according to SLOCCount, and takes around 15 mins to do a clean build on my workstation. I tested putting all the source, output dirs and ivy cache in a RAM disk, and was really surprised that it made less than 20% difference. I guess disk caches are really good these days.
Sorry, but this is stupid. Your Os already caches files in your ram. No need for a Ram Disk.
I've been using a Ram disk as the TEMP folder on Windows for more than a year and the overall speed of the system is quite better than without it, and certainly quite less disk activity. You can change the temp folder location in the enviroment settings.

The advantages besides speed are, the temp folder cleans up every time you restart, it's also useful for storing anything disposable, an archive you'll need to download only once and use its contents, and useful for doing anything potentially unsafe for your regular disk.

The disadvantage for setting your temp folder to the ram disk is that sometimes, some programs will try to store a lot of data on the temp folder and fill it up (I use 384mb), but that's something you can usually change in the programs' settings.

In Ubuntu,

    vi /etc/sysctl.conf
    vm.swappiness = 0
There's a lot of 'that doesn't make sense' comments here, but let me tell you, it CAN make a difference.

My linux machine was having issues with one of its hard drives (an external one) being slow to access. For some reason, chrome would decide to hit that drive once in a while and that would halt everything for a few seconds while it did so. I told it to stop using disk cache at all and suddenly everything is much nicer.

With apps waiting on disks for -any- reason, it doesn't surprise me that making the temp dir be ultra-fast helps.