[Zope-dev] Last-modified and bobobase_modification_time
Wei He
hewei@mail.ied.ac.cn
Tue, 18 Jun 2002 10:31:07 +0800 (CST)
On Mon, 17 Jun 2002, Dieter Maurer wrote:
> R. David Murray writes:
> > ...
> > Well, there's two aspects to this. The first one is the quesiton of
> > *why* the last modified header is currently that of the outermost
> > page template. That's a zope@zope.org question. The second is
> > the question of whether or not that is the "right" behavior, and what
> > it would take to make Zope smarter such that the last modified header
> > would actually be accurate.
> Think about it. It is very difficult.
>
> In order to determine the accurate modification time, you need
> to render the template (as it is non-trivial to determine the
> set of objects the rendering depends on without actually
> doing the rendering).
>
> Rendering may produce side effects. But "HEAD" requests
> are required by HTTP not to have side effects. Thus,
> you cannot have accurate modified headers for "HEAD" requests.
> Moreover, usually "HEAD" requests do not pass the necessary
> parameters for template rendering.
Would please go a little bit deeper giving an example what information
HEAD requests don't pass to the server, although it's beyond this topic.
>
> To get it right for non-"HEAD" requests, you would need to
> pass an implicit state through most of the application.
> Any time, you access an object's attribute, you must
> take its last modification time into account, as the last
> modification may have changed the attribute you are
> accessing.
That makes sense. But let me introduce my opinion from two aspects.
1. From the Zope developers' point of view, there definately needs a
careful optimization to avoid unnecessary database update, even sometimes
it may break the intrastructure. The key is that technologies server contents.
MySQL and PHP's success is somehow an example.
2. From the website developers' point of view, there are already many
guidlines on how to create a good webpage. Among them are using the HTTP
Last-modification header to take the advantages of client cache. For
example when I design my websites using PHP, all performance-sensitive
database queries are executed before any contents output. The HTTP
header is then generated according to the query results, which each of
them have their own timestamp stored in the databse. That might be a
weakness of a template system, but making good use of the protocol is a
thing need to be considered whenever possible.
> I expect, it will give a significant performance penalty, at least,
> even when you come up with an ingenious implementation idea.
>
>
I agree. There is always a trade off between funcationality and
performance. But isn't Zope such an ingenious idea that makes content
serving no longer as fast as they used to be?
Wei He