6

I'm developing a Java EE web application and I'm trying to speed up the testing process. To do so I was wondering if there is a way to tell the system to keep my build folder in system memory?

3
  • 2
    Any particular OS, or should we just pick a random one for you? Commented Jan 10, 2012 at 2:21
  • Sorry, I didn't think which distro mattered. It's Linux Mint Commented Jan 10, 2012 at 2:58
  • Distro doesn't. OS does. Commented Jan 10, 2012 at 3:03

3 Answers 3

4

Yes. You can put the folder in a RAM disk.

I would write up instructions, but a lot of people have already done good jobs at that, like the guy that wrote http://blulin.wordpress.com/2008/11/28/tips-to-create-ramdisk-in-a-linux-system/

Keep your source and work in a folder on a hard disk, and when you're going to test, just rsync that directory to the ramdisk you're going to create using the page i linked to.

Do all your testing.

Save all your work back to your folder on the hard disk.

Voila!

ps. That "Save your work" step is a must. When you unmount a ramdisk, everything is gone. there is no such thing as a ram disk that provides persistent storage.

3

Normally the system puts everything into cache as long there is free memory available, so normally this step does not seem to be necessary.

Check if there is a /dev/shm mountpoint. On most distributions halve of your RAM is mounted there as ramdisk.

3

You can use tmpfs.

tmpfs is a fast, dynamically allocated, easy to use, temporary file storage facility, that will swap to disk when you run out of memory. Although a ramdisk has some advantages in other use cases, tmpfs will suit your needs best.

For one time use:

sudo mount -t tmpfs none /path/to/directory

When you want to mount the directory as tmpfs everytime you boot, append the following to /etc/fstab:

none /path/to/directory tmpfs defaults 0 0

Warning: Everything you write into your tmpfs directory will be lost on shutdown, so save or rsync everything when you are done.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.