How to serve images from memory?

Steve Grimm sgrimm at facebook.com
Mon Jul 2 16:48:10 UTC 2007


On 7/1/07 5:59 PM, "Cathy Murphy" <cathy at nachofoto.com> wrote:
> In Apache, is there a way to serve images from memory instead of disk?

The easiest way is to make sure your server has enough memory for all the
images (which you¹d obviously need anyway) then just let the OS¹s buffer
cache keep all the files in memory. You can mount the image filesystem with
the ³noatime² option or equivalent (check your OS¹s docs to see what it¹s
called in your environment) to prevent it from writing out the last access
time when a file is read.

It doesn¹t guarantee you no disk accesses, of course, but it¹s MUCH easier
to set up than the alternatives and for most purposes should offer you about
the same performance.

The big trick ‹ which you also need to do if you¹re using memcached ‹ is to
make sure the server isn¹t doing a lot of other stuff. If there¹s lots of
unrelated disk activity, your images will fall out of the buffer cache. But
even if you were running memcached, a lot of unrelated activity would
potentially cause memcached to start getting swapped out.

-Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070702/6bea8eca/attachment.htm


More information about the memcached mailing list