<HTML>
<HEAD>
<TITLE>Re: How to serve images from memory?</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>On 7/1/07 5:59 PM, "Cathy Murphy" <cathy@nachofoto.com> wrote:<BR>
> In Apache, is there a way to serve images from memory instead of disk?<BR>
<BR>
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.<BR>
<BR>
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.<BR>
<BR>
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.<BR>
<BR>
-Steve<BR>
</SPAN></FONT>
</BODY>
</HTML>