Faster Browsing With RAM Disks

esperancedv

A coworker approached us today wondering if they could get a performance boost using Samsung’s newly announced 256GB SSD. Most of their work is done in browser, so we said “no”. They’d only see benefit if they were reading/writing large files. Their system has plenty of RAM, and we decided to take a different approach. By creating a filesystem in RAM, you can read and write files much faster than on a typical hard drive. We decided to put the browser’s file cache into RAM.

We installed the Espérance DV preference pane in OSX to facilitate RAM disk creation. It’s really simple to setup. Just select how much space you want to dedicate to the disk and create it. You can have Espérance DV recreate the RAM disk on start and even have it automatically restore from a disk image. There is a check box for moving Safari’s Web Cache to the RAM disk, which creates the necessary symlink. You can also use it to speed up Xcode builds. Moving Firefox’s cache is fairly simple:

$ rm -r ~/Library/Caches/Firefox
$ ln -s /Volumes/RamDisk/Firefox ~/Library/Caches/Firefox

Since the browser isn’t having to hit the hard disk on every page load anymore, the performance is much snappier. Xbench says our random reads from RAM are now 86.19MB/sec instead of 0.61MB/sec when the cache was on the hard drive.

We immediately began looking for ways to get the entire OS into RAM; Tin Hat is a version of Linux that does that.

We’re very happy with the results of our RAM disk browser upgrade. Let us know in the comments if you’ve had a similar experience doing this in Windows.

70 thoughts on “Faster Browsing With RAM Disks

  1. Caching desktop applications in RAM… Hmmm, it never occurred to me that my software wasn’t already caching properly.

    I do normally use this for hacks I do for little web apps (amateur things though they are) … If I have to set and get little bits of data I will often shove them somewhere in /dev/shm (normally don’t bother to consider Windows boxes)

    but, hmmm, now I’m thinking “I wonder if I can do that in Windows without paying a smallhuge fee!” … I used to have some freeware lying around which let me create a ramdisk. It was awesome but I only had 32MB of RAM and soon gave that b ack to my applications to use as …. as….. well, to use the RAM as RAM. Tada!

  2. update on the Firefox not opening issue. If you make the RamDisk invisible, add a . in front of the ram disk name. Example:

    $ rm -r ~/library/caches/firefox

    $mkdir /volumes/.ramdisk/firefox\ \(\cache\)

    $ ln -s /volumes/.ramdisk/firefox\ \(\cache\) ~/library/caches/firefox

  3. Ok, srsly.
    All the fags talking about “copying OS to a ramdrive” are out of your mind retarted!

    RAM drives are whipped clean every time you restart your computer.

    If you moved all your OS8 files to a ramdisk, you’d have no OS.

    You can’t ever EVER boot from a RAM disk. NEVER NEVER NEVER!

    In theory, you could load all the system files to RAM at startup, then boot the system from that, but think about that for about ten seconds and you’ll realize why that’s a stupid redundant idea…

  4. please help me to change the cache directory of safari to ramdisk in WINDOWS XP. i have a free software which can create upto 3GB ramdisk in XP. if u still need this then contact “Shohug_0301012@yahoo.com”

  5. This made me think… here is an opportunity for OS innovation:
    OSes should have some native support to go all out for performance.
    For this topic, an OS would allow programs to create folders with a special type “cache folder” and a maximum size for it.
    This would allow the OS to create a RAMdrive with enough size for all those caches.
    Windows 7 is coming soon, it would be interesting to have such a thing…

  6. Puppy can be set to eliminate Flash Writes during a session unless they are requested during a session or upon exit. If you have no need to “save locally?” That session in theory uses *zero* flash writes.

    IF you can live with the risk about work in progress losses? Mitigation’s possible. Look no further than Gmail for a conceptual answer. A Gmail session “autosaves” drafts at intervals.

    So,for netbooks with internal WLAN or any “connected” machines it’s potentially a done deal.By a use of remote caching/s. Oh, you “can” write back to the local flash on exit if you want to .. But Why would you do so for 99% of your session’s data when it’s only 1% likely needing local saves.

  7. Hold the boat man… all these people screaming “STUPID” and “LAME” aren’t even considering that any program you run… (pretty much ANY)… during the ENTIRE time that you’re running it, is going to run better if it’s on a ramdrive.

    Now what is an OS? It’s a program.

    Consider the Windows Vista can be sped up by providing a thumb drive for cache. That’s not a hack, but a FEATURE of the OS. Hmm, why and how?

    Well… stuff is faster in RAM. Period. Naysayers, your arguments are uneducated and ill informed.

  8. Cool Tip…totally made Firefox unuseable on my Mac! Tried re-installing Firefox but no joy. Guess I’ll just spend 200 days re-installing the entire SL install on my Mac. Excellent!

  9. i did something like this a while ago on linux.
    first i turned my /tmp folder into a tmpfs partition, so its a ramdisk that changes size as needed up to 1/2 your total ram(by default, you can make it more or less)
    then i moved my firefox profile (~/mozilla/firefox/(random guid).default) to a permanent place, then copies it to the /tmp directory and deleted it, then symlinked from the /tmp to ~/mozilla/firefox/(its name) i also deleted cookies.sqlite and sessionstore.js and linked from their permanent location (so that changes to them would persist even if the computer suddenly took a nosedive.) then created a startup script to automate this process. this way everything firefox needs is in ram, it runs much nicer.
    i also moved my ~/.Thumbnails to /tmp and linked to back to ~ this made thumbnails load faster AND it deleted them when my computer shut down(along with any incriminating evidence.)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.