Slashdot Mirror


Other Uses For The Linux RAM Disk?

Dante_J asks: "Recently I discovered an old Amiga DOS 1.3 Manual I had lying around. While thumbing through it I remembered all the joyful days of good fun hacking. One thing I particularly remembered was how anyone with 3Mb of ram was considered especially blessed with resources because they could copy all their system files into the ram disk and have a 'trans-warp' fast machine on their hands. In this age of more Ram than sense why are Ram Disks only used for Linux installation floppies? Sure buffers are great, but why not mount /tmp to a Ram Disk, and the cache directory for Web browsers too? Does Linux support dynamically reseizing Ram Disks? Surely they would be vital in remote booting, diskless thin clients."

5 of 320 comments (clear)

  1. Dynamic Sizing of Ramdisks by Jason+Straight · · Score: 5

    The 2.4 kernel does support dynamic ramdisks.

  2. Solaris already does by larien · · Score: 5
    At least, the /tmp bit. Under Solaris, /tmp is effectively part of virtual memory (used to be just swap space, now includes physical RAM). Causes several problems as:
    • files disappearing from /tmp on reboot which users didn't expect
    • large files eating up swap space
    Personally, I find it a great idea; just some admins don't like it as much.
    --
  3. ramdisk vs. hard disk by VoidOfReality · · Score: 5

    Where I work, we use a bunch of Linux boxes to serve our website. Currently, all of our content is located in ramdisk, as well as a data cache used by the web applications that we run. I'm currently on a project to evaluate the merits of using hard disk for this as opposed to the ramdisk that we're currently using.

    The results of the performance test that I ran were somewhat surprising - it seems the machine with the hard disk actually performed _better_ than the machine with the ramdisk. I'm not a kernel hacker so I don't know exactly why this is the case, but I know that the buffer caching in the kernel really kicks ass (we're running 2.2.10) and I suspect having a ramdisk hampers the kernel's ability to manage the buffer cache (i.e., it takes up space that could be used for buffer cache). Just my $.02...

    -VoR

    1. Re:ramdisk vs. hard disk by Mr+Z · · Score: 5
      The results of the performance test that I ran were somewhat surprising - it seems the machine with the hard disk actually performed _better_ than the machine with the ramdisk. [...] and I suspect having a ramdisk hampers the kernel's ability to manage the buffer cache.

      You're partly right. The other reason is that it forces more pages out to swap, since the RAM disk can't be paged out (I'm pretty sure). Placing your data in a traditional Linux RAM disk has two bad effects:

      • It reduces the total amount of RAM available to applications. This results in more paging activity.
      • It reduces the size of the buffer cache, meaning that files outside the set you've placed in RAM are more likely not cached. This also includes filesystem metadata, such as block bitmaps and the like.

      Even if the Linux ramdisk can be swapped out (I think the new ramfs may be capable of this), it will still likely be slower than a traditional filesystem if you push into swap, because swap gets fragmented over time. In contrast, ext2 resists fragmentation pretty well and so will perform better as a result.

      My 0x02 cents...

      --Joe
      --
  4. Unix/Linux does this for you automatically by IGnatius+T+Foobar · · Score: 5

    Unix/Linux does this for you automatically. The disk caching functionality will keep the disk blocks belonging to recently used programs in memory -- so if you have a lot of memory, you'll simply find that once you've typed a few commands, the machine doesn't have to go to disk to fetch them on subsequent runs.

    This actually reflects the perfect way of doing this: add optimization, but don't bug the users about it -- it's not their problem.
    --

    --
    Tired of FB/Google censorship? Visit UNCENSORED!