These days, RAM is not as expensive as it use to be, therefore almost anyone can afford to have a lot more memory that he / she really needs. If you have more memory that your system usually needs you can give it a really good use.
As everybody knows, RAM is faster, way faster than hard disks, then, why not use RAM to perform actions that require a lot of disk I/O tasks.
Let see some examples:
The /cache file, where Drupal boost or Super Cache from WordPress are storing its files.
.css .js .ico and other files your webserver uses a lot.
Your entire site, if it is small and static.
This way, if one page of your web site, suddenly becomes popular, it will be served really fast, otherwise, even if you have a lot of bandwidth, and even if you have Nginx serving your pages, you may experience slow page loading due to I/O disk problems.
Create the RAM disk
You may already have a RAM disk in
/dev/shm but it is a good idea to create your own, in order to have exclusive use of it.
Create a directory to mount the RAM disk
I will do it in my web server folder.
sudo mkdir -p /var/www/mysite/cache
Now mount there a RAM disk.
sudo mount -t tmpfs -o size=700M,mode=0744 tmpfs /var/www/mysite/cache
Now, this is done for Drupal and boost, but you may use for any other application.
Doing this, Drupal, will store its cache boost generated files there, if someone is not found, it will be re-generated.
Of course if you plan to copy all your site there, be sure not to edit any file in the RAM folder, or it will be lost when you reboot your computer.
You can schedule a cron job to sync you real files to this folder. Or do it at boot time with
Uses are endless, this is just one of them.
— One more thing, be sure not to use too much of your free memory, or you will end up with other problems, just to scape from one. I think that 20 to 30 percent of the available RAM can be used this way.