[Caching] Inefficient HTML cache?
We use Apache for caching and observe the following behaviour: Apache requests the object from Zope and caches it until the expiration date is reached. From then on, Apache forwards "If-Modified-Since" requests to Zope, Zope responds with an "304" response but without a new expiration date! As Apache does not get new expiration info, it continues to forward "If-Modified-Since" requests for the object. This significantly reduces cache efficiency. In my view, Zope should include new expiration info in its "304" responses. The CachingManager API may need to be extended, to allow the HTTP CacheManager to add information to "304" responses. -- Dieter
Dieter Maurer wrote at 2004-11-20 10:08 +0100:
We use Apache for caching and observe the following behaviour:
Apache requests the object from Zope and caches it until the expiration date is reached. From then on, Apache forwards "If-Modified-Since" requests to Zope, Zope responds with an "304" response but without a new expiration date! As Apache does not get new expiration info, it continues to forward "If-Modified-Since" requests for the object. This significantly reduces cache efficiency.
In my view, Zope should include new expiration info in its "304" responses.
Meantime, I checked that the HTTP 1.1 spec requires that "Expires", "Cache-Control" and "Vary" should indeed be resent, if they are different from the original response (which is quite likely for automatically determined "Expires" headers).
The CachingManager API may need to be extended, to allow the HTTP CacheManager to add information to "304" responses.
HTTP 1.1 requires further that other headers (different from "Date", "Expires", "Cache-Control" and "Vary") are not resent in an 304 response (in order not to cause cache consistency problems). This is difficult to achieve with e.g. the "Caching Policy Manager" (which would add "max-age" as well). I think, however, that a violation of this rule will not cause serious problems. -- Dieter
Dear Dieter, --On 20 November 2004 10:08 +0100 Dieter Maurer <dieter@handshake.de> wrote:
We use Apache for caching and observe the following behaviour:
Apache requests the object from Zope and caches it until the expiration date is reached. From then on, Apache forwards "If-Modified-Since" requests to Zope, Zope responds with an "304" response but without a new expiration date! As Apache does not get new expiration info, it continues to forward "If-Modified-Since" requests for the object. This significantly reduces cache efficiency.
In my view, Zope should include new expiration info in its "304" responses.
The CachingManager API may need to be extended, to allow the HTTP CacheManager to add information to "304" responses.
We've noticed the same behaviour and, for that reason, have avoided using the HTTP CacheManager in Zope. Instead, we handle headers (and 304 responses) for "standard" pages in the main_template and the rest of the caching on Apache (using mod_expires for outbound responses). +1 for fixing this behaviour. Dominic
participants (2)
-
Dieter Maurer -
Dominic Hiles