Serving html from linux ramdisk

StCee asked:

I have seen a somewhat dated tutorial that suggest serving html files with a ramdisk
like this:

mkfs -q /dev/ram1 102400

I also find another source that use something like this:

mount -t tmpfs -o size=1024 none /mnt/rds

Are these two methods equally valid? I am using Centos 6.3 with nginx. So in practice I want to serve the files in /usr/share/nginx/html from RAM.

And in case I mounted the disk, do I have to mount again whenever there is a genuine change in the original folder?

My answer:

Why bother? Linux is just going to cache them in RAM anyway, the first time they get read from disk. And if they’re read frequently enough they’ll always be cached.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.