httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@gbiv.com>
Subject Re: [PATCH]: mod_cache: don't store headers that will never be used
Date Mon, 30 Jul 2007 00:22:53 GMT
On Jul 29, 2007, at 1:03 AM, Niklas Edmundsson wrote:
> Attached is a patch for mod_cache (patch is for httpd-2.2.4) that  
> implements what I suggested in May (see the entire thread at
> http://mail-archives.apache.org/mod_mbox/httpd-dev/200705.mbox/% 
> 3cPine.GSO.4.64.0705211627320.5452@kleopatra.acc.umu.se%3e ).
>
> The problem is that cached objects that gets hammered with Cache- 
> Control: max-age=0 requests will get their on-disk headers  
> rewritten for each request, and since max-age=0 are always  
> revalidated (hence the rewriting in the first place) those  
> rewritten on-disk headers will never be used. Since the ground rule  
> of caching is to cache stuff that's being reused this is rather  
> suboptimal.
>
> The solution is to NOT rewrite the on-disk headers when the  
> following conditions are true:
> - The body is NOT stale (ie. HTTP_NOT_MODIFIED when revalidating)
> - The on-disk header hasn't expired.
> - The request has max-age=0
>
> This is perfectly OK with RFC2616 10.3.5 and does NOT break anything.

No, it breaks the refreshing of the on-disk header with a new Date
field representing its new age.  The patch would cause a prefetching
spider to fail to do its intended job of refreshing all cached entries
even when they are not yet stale, which is something that content
management systems do all the time when fronted by a caching server.

As I said before, address the problem you have by adding a directive
to either ignore such requests from abusive downloaders or to define
a minimum age for certain cached objects.  HTTP does not require the
cache configuration to be that of a transparent cache -- it only
defines how a cache configured to be transparent should work.

....Roy


Mime
View raw message