You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Marr <gr...@alum.wpi.edu> on 2006/10/27 20:47:47 UTC
Re: svn commit: r468373 - in /httpd/httpd/trunk: CHANGES
modules/cache/mod_cache.c modules/cache/mod_cache.h
modules/cache/mod_disk_cache.c modules/cache/mod_disk_cache.h
modules/cache/mod_mem_cache.c
At 01:41 PM 10/27/2006, Davi Arnaut wrote:
>Niklas Edmundsson wrote:
> > And when you have a file backend, you want to hit your disk cache
> and
> > not the backend when delivering data to a client. People might
> think
> > that this doesn't matter, but for large files, especially larger
> than
> > RAM in your machine, you usually go disk-bound without much help
> from
> > the OS disk cache.
>
>But that's a corner case. There is no reason in doing this for small
>files (common case). For example, in a enterprise grade server
>memory is
>cheap and permanent storage is slow and expensive.
So why would this server be using mod_disk_cache in that
case? Shouldn't this server be using mod_mem_cache? Selecting
mod_disk_cache over mod_mem_cache means it's better to serve the
cache from disk rather than from memory. If serving from the disk on
the original request is too slow, then wouldn't serving from the disk
on the subsequent requests be too slow as well?
Re: svn commit: r468373 - in /httpd/httpd/trunk: CHANGES modules/cache/mod_cache.c
modules/cache/mod_cache.h modules/cache/mod_disk_cache.c modules/cache/mod_disk_cache.h
modules/cache/mod_mem_cache.c
Posted by Graham Leggett <mi...@sharp.fm>.
Davi Arnaut wrote:
> Because the data is already in memory. Why should I write something to
> disk, erase it from memory, and read it again shortly ? Why should I
> take care of something that is the job of the OS ? Why should I trash
> the VM constantly ?
Because reading slowly from a cache disk is less resource intensive than
reading from CGI, proxy, slow NFS drives, etc. And reading from cache
disk gives you SENDFILE. Try it out, you will see.
Regards,
Graham
--
Re: svn commit: r468373 - in /httpd/httpd/trunk: CHANGES modules/cache/mod_cache.c
modules/cache/mod_cache.h modules/cache/mod_disk_cache.c modules/cache/mod_disk_cache.h
modules/cache/mod_mem_cache.c
Posted by Davi Arnaut <da...@haxent.com.br>.
Davi Arnaut wrote:
> Greg Marr wrote:
>> At 01:41 PM 10/27/2006, Davi Arnaut wrote:
>>> Niklas Edmundsson wrote:
>>>> And when you have a file backend, you want to hit your disk cache
>>> and
>>>> not the backend when delivering data to a client. People might
>>> think
>>>> that this doesn't matter, but for large files, especially larger
>>> than
>>>> RAM in your machine, you usually go disk-bound without much help
>>> from
>>>> the OS disk cache.
>>> But that's a corner case. There is no reason in doing this for small
>>> files (common case). For example, in a enterprise grade server
>>> memory is
>>> cheap and permanent storage is slow and expensive.
>> So why would this server be using mod_disk_cache in that
>> case? Shouldn't this server be using mod_mem_cache? Selecting
>> mod_disk_cache over mod_mem_cache means it's better to serve the
>> cache from disk rather than from memory. If serving from the disk on
>> the original request is too slow, then wouldn't serving from the disk
>> on the subsequent requests be too slow as well?
>>
>
> Because the data is already in memory. Why should I write something to
> disk, erase it from memory, and read it again shortly ? Why should I
> take care of something that is the job of the OS ? Why should I trash
> the VM constantly ?
I should note that if there is enough memory those reads will be served
by the page cache. Later we could think about reading directly to
mmapable files, changing it's protection (from rw to ro) as soon as we
are done writing to.
--
Davi Arnaut
Re: svn commit: r468373 - in /httpd/httpd/trunk: CHANGES modules/cache/mod_cache.c
modules/cache/mod_cache.h modules/cache/mod_disk_cache.c modules/cache/mod_disk_cache.h
modules/cache/mod_mem_cache.c
Posted by Davi Arnaut <da...@haxent.com.br>.
Greg Marr wrote:
> At 01:41 PM 10/27/2006, Davi Arnaut wrote:
>> Niklas Edmundsson wrote:
>>> And when you have a file backend, you want to hit your disk cache
>> and
>>> not the backend when delivering data to a client. People might
>> think
>>> that this doesn't matter, but for large files, especially larger
>> than
>>> RAM in your machine, you usually go disk-bound without much help
>> from
>>> the OS disk cache.
>> But that's a corner case. There is no reason in doing this for small
>> files (common case). For example, in a enterprise grade server
>> memory is
>> cheap and permanent storage is slow and expensive.
>
> So why would this server be using mod_disk_cache in that
> case? Shouldn't this server be using mod_mem_cache? Selecting
> mod_disk_cache over mod_mem_cache means it's better to serve the
> cache from disk rather than from memory. If serving from the disk on
> the original request is too slow, then wouldn't serving from the disk
> on the subsequent requests be too slow as well?
>
Because the data is already in memory. Why should I write something to
disk, erase it from memory, and read it again shortly ? Why should I
take care of something that is the job of the OS ? Why should I trash
the VM constantly ?
A proxy/cache common purpose is to cache web content, this means we have
a large number of small files (think html pages, images, etc) that we
must keep in a permanent storage, but if we have memory, let's use it!
--
Davi Arnaut