Running a Site on a Ram Disk


There is a dearth of information available on performance benchmarks for running a web site from a RAM disk, so I decided to do a little bit of playing around on my own.

I first tried to put MediaWiki on a ram disk, since it is the worst performing application that I'm aware of. It didn't work. All I saw was a blank page, which is exactly what I saw when I used eaccelerator to increase the speed. I hate the performance of my Wiki, but I do really appreciate the ease of publishing. I'm dreading the day when I have to migrate files away from it, but I digress...

In the alternative, I decided to move the blog section of my site over to a RAM Disk. Actually, I tried moving the whole thing other than the wiki over, but unfortunately I have a few hundred megabytes of files up here that nobody knows about.


Once I moved the blog over, I ran some performance benchmarks, and surprisingly I saw very little to no performance benefit. The linux system itself does a pretty good job of keeping things cached. I expected to see something more impressive.

One thing that you can use a RAM disk for is to maintain your session data, although from what I'm seeing with static files, you will only see a performance benefit on older sessions, which you should be expiring anyways. I've read that another and more recommended option is using the tmpfs file system for your /tmp mount as opposed to ext3 or ext2.

Something else I considered was moving perl files into a RAM disk to increase perl performance, but I haven't tried that out. I have a feeling I'd see the same results - not much of a performance improvement.

Of course, you could run all of apache off of a RAM disk too, but I see little point in that. Aside from fast configuration reads, I don't see much of a point, and log files would eat your RAM pretty quickly.

Perhaps under a big load it would make a difference, or perhaps with sites that make more use of scripting - although for script acelleration using something like eaccelerator makes more sense than moving files themselves into memory.

I've toyed with the idea of moving mysql databases into memory, but that makes them ripe for corruption in case of a mysterious reboot or random problem like that. Ramdisks could be useful to speed up big imports or large transactions on a one-off basis.



Running a Site on a Ram Disk Interaction