Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was wondering the other day why wouldn't one place all the htdocs related files in a RAM disk.

It seems to me, that this would greatly improve the time it takes for the disk to lookup and read files, greatly improving performance - specially for high websites with a high concurrency hit rate.

Is there a package that can implement this in a transparent way for reading operations, while at the same time making sure the write operations are safely stored on disk? If not, is there a reason not to?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Is there a package that can implement this in a transparent way for reading operations, while at the same time making sure the write operations are safely stored on disk?

Yes there is, it's part of the operating system.

All modern operating systems have what is called a filesystem cache. This is a portion of RAM that is unused for any applications that gets used by the kernel to store recently accessed files. It is also used to store recently written files until they are periodically flushed to the disk.

When an application needs the RAM, it is transparently given up by the kernel.

share|improve this answer

I was wondering the other day why wouldn't one place all the htdocs related files in a RAM disk.

Because modern operating systems already cache stuff in memory as needed, and can usually manage this process more efficiently if left alone to get on with it. All you're doing with a RAM disk is creating your own manual version of this cache.

share|improve this answer

Since most websites are dynamic - accelerating access to just static data (htdocs) does not help that much. But most production sites do use Memcached/MemcacheDB like technologies.

Memcached is a general-purpose distributed memory caching system that was originally developed by Danga Interactive for LiveJournal, but is now used by many other sites. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.

share|improve this answer
    
Yes, but we don't put static assets in memcached. There's no point. –  Michael Hampton Mar 3 '13 at 20:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.