You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by PN...@directsourcing.com on 2000/01/24 16:00:03 UTC

Cache

Here are my two cents on Cache

Yes Cocoon is a dynamic publishing framework, but how dynamic a site would
be. Let's take an example of a typical site which serves output depending on
the client. Site content is stored in xml. Most of the time maximum hit a
site would get is the main page. Won't it make sense to just keep it stored
in the requested format(html,wml etc.) and just check if the source xml has
changed. External file inclusion makes more sense over here. 

Pankaj


Re: Cache

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Stefano Mazzocchi wrote:
> 
> PNarula@directsourcing.com wrote:
> >
> > Here are my two cents on Cache
> >
> > Yes Cocoon is a dynamic publishing framework, but how dynamic a site would
> > be. Let's take an example of a typical site which serves output depending on
> > the client. Site content is stored in xml. Most of the time maximum hit a
> > site would get is the main page. Won't it make sense to just keep it stored
> > in the requested format(html,wml etc.) and just check if the source xml has
> > changed. External file inclusion makes more sense over here.
> >
> > Pankaj
> 
> This is the plan: you generate the static part from the command line
> (like stylebook does today for xml.apache.org) and you let Cocoon handle
> everything else.

+1 :) :) :)

> Letting the web server do its job it's always the best option, we
> already know this.

Yep, totally :)

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: Cache

Posted by Stefano Mazzocchi <st...@apache.org>.
PNarula@directsourcing.com wrote:
> 
> Here are my two cents on Cache
> 
> Yes Cocoon is a dynamic publishing framework, but how dynamic a site would
> be. Let's take an example of a typical site which serves output depending on
> the client. Site content is stored in xml. Most of the time maximum hit a
> site would get is the main page. Won't it make sense to just keep it stored
> in the requested format(html,wml etc.) and just check if the source xml has
> changed. External file inclusion makes more sense over here.
> 
> Pankaj

This is the plan: you generate the static part from the command line
(like stylebook does today for xml.apache.org) and you let Cocoon handle
everything else.

Letting the web server do its job it's always the best option, we
already know this.

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------



Re: Cache

Posted by Stefano Mazzocchi <st...@apache.org>.
Hannes Haug wrote:
> 
> Pierpaolo Fumagalli wrote:
> >
> > That's how Cocoon 2.0 cache should work. If all
> > producer/formatter/serializer in my construction chain report that their
> > bahaviour is not changed since last operation, then the cached content
> > is served,
> 
> Or the fast external cache is told that the cached entry is still valid.

True, I'd love to see something like this in place. Want to help? :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Come to the first official Apache Software Foundation Conference!  
------------------------- http://ApacheCon.Com ---------------------



Re: Cache

Posted by Hannes Haug <Ha...@Haug.com>.
Pierpaolo Fumagalli wrote:
> 
> AAAARRRRGGGGGHHHHH that's a very dirty hack....
> Also http://localhost:81/servlet can be different from
> http://localhost/servlet...

Of course  http://localhost:81/servlet is different
from http://localhost/servlet. But is it really dirty?
It's a cache that is in front of the real web-server.
This needs some configuration like this. It's not perfect.
But it's a start. Extending mod_proxy to do the caching
more internally would _perhaps_ be a good thing. But I
think that then mod_proxy and mod_jserv would run in the
same thread or process. And _perhaps_ this is a problem.

> I don't like it... Sorry... (and it doesn't solve
> the problem of caching dynamically generated data!)

It's not perfect. But I wouldn't say that it doesn't
solve the problem of caching some dynamically generated
data. It does so for the mod_perl people. The real problem
is that mod_proxy doesn't support content negotiation.

  -hh

Re: Cache

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Hannes Haug wrote:
> 
> Pierpaolo Fumagalli wrote:
> >
> > Can we? Are you sure about that? I can't remember anything in mod_proxy
> > that allow you to cache locally generated/served content... I must admit
> > my total ignorance on this.
> 
> ProxyPass        /servlet/ http://localhost:81/servlet/
> ProxyPassReverse /servlet/ http://localhost:81/servlet/
> 
> That's not really local. ProxyPath maps some remote space
> into local space. For more complicated things there is
> mod_rewrite.

AAAARRRRGGGGGHHHHH that's a very dirty hack....
Also http://localhost:81/servlet can be different from
http://localhost/servlet...

I don't like it... Sorry... (and it doesn't solve the problem of caching
dynamically generated data!)

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: Cache

Posted by Hannes Haug <Ha...@Haug.com>.
Pierpaolo Fumagalli wrote:
> 
> Can we? Are you sure about that? I can't remember anything in mod_proxy
> that allow you to cache locally generated/served content... I must admit
> my total ignorance on this.

ProxyPass        /servlet/ http://localhost:81/servlet/
ProxyPassReverse /servlet/ http://localhost:81/servlet/

That's not really local. ProxyPath maps some remote space
into local space. For more complicated things there is
mod_rewrite.

 -hh

Re: Cache

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Hannes Haug wrote:
> 
> Pierpaolo Fumagalli wrote:
> >
> > Yes. Just consider this case: We have two clients: ClientA and ClientB.
> > They don't use proxies, or they use different ones,
> 
> We can force them to use OUR proxy. That's the point.

Can we? Are you sure about that? I can't remember anything in mod_proxy
that allow you to cache locally generated/served content... I must admit
my total ignorance on this.

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: Cache

Posted by Hannes Haug <Ha...@Haug.com>.
Pierpaolo Fumagalli wrote:
>
> Yes. Just consider this case: We have two clients: ClientA and ClientB.
> They don't use proxies, or they use different ones,

We can force them to use OUR proxy. That's the point.

 -hh

Re: Cache

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Hannes Haug wrote:
> 
> Pierpaolo Fumagalli wrote:
> >
> > I bet that for checking cache, proxies issue a HEAD command instead of a
> > GET or POST, if they can do it, and in case of HEAD requests, we need to
> > specify that the document wasn't changed.
> 
> It's a GET with a If-Modified-Since header or something similar.

I thought it was a HEAD. But no problems... If it's the same thing, we
don't have to send the content in both cases...

> > There are three cases:
> >
> > 1) The document need to be generated (generate the whole stuff)
> > 2) The document is cached but not proxied (send content in cache)
> > 3) The document is cached and proxied (just reply that it didn't change)
> 
> Why do we need 2) at all?

Yes. Just consider this case: We have two clients: ClientA and ClientB.
They don't use proxies, or they use different ones, and it's the first
time that they, or theyr proxy servers, hit the
"http://foo.bar/cocoon/generated/doc.xml" page.
This page is simply an XML file with a stylesheet applied to it (so we
can check if the source XML or XSL have changed from the last
generation).
ClientA hits "http://foo.bar/cocoon/generated/doc.xml" at 1200 hours
exactly, Cocoon, for the first time, generates the page, sends it to
ClientA and stores it into its cache.
ClientB hits the same url at 1201 hours, and, since it's the first time
he tries to get that url, he cannot provide a If-Modified-Since header.
If Cocoon has a cache, then he can see  that no changes were made to the
XML and to the XSL since 1200 hours, and serve the cached content,
while, if he doesn't, he HAS to regenerate the page. So, we avoid one
generation step :)

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: Cache

Posted by Hannes Haug <Ha...@Haug.com>.
Pierpaolo Fumagalli wrote:
> 
> I bet that for checking cache, proxies issue a HEAD command instead of a
> GET or POST, if they can do it, and in case of HEAD requests, we need to
> specify that the document wasn't changed.

It's a GET with a If-Modified-Since header or something similar.

> There are three cases:
> 
> 1) The document need to be generated (generate the whole stuff)
> 2) The document is cached but not proxied (send content in cache)
> 3) The document is cached and proxied (just reply that it didn't change)

Why do we need 2) at all?

 -hh

Re: Cache

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Hannes Haug wrote:
> 
> Pierpaolo Fumagalli wrote:
> >
> > That's how Cocoon 2.0 cache should work. If all
> > producer/formatter/serializer in my construction chain report that their
> > bahaviour is not changed since last operation, then the cached content
> > is served,
> 
> Or the fast external cache is told that the cached entry is still valid.

Uh... yes.. Totally... I wasn't catching your point...
Definitely this is something that works.
I bet that for checking cache, proxies issue a HEAD command instead of a
GET or POST, if they can do it, and in case of HEAD requests, we need to
specify that the document wasn't changed.

There are three cases:

1) The document need to be generated (generate the whole stuff)
2) The document is cached but not proxied (send content in cache)
3) The document is cached and proxied (just reply that it didn't change)

	Pier
-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------

Re: Cache

Posted by Hannes Haug <Ha...@Haug.com>.
Pierpaolo Fumagalli wrote:
> 
> That's how Cocoon 2.0 cache should work. If all
> producer/formatter/serializer in my construction chain report that their
> bahaviour is not changed since last operation, then the cached content
> is served,

Or the fast external cache is told that the cached entry is still valid.

 -hh

Re: Cache

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
PNarula@directsourcing.com wrote:
> 
> Here are my two cents on Cache
> 
> Yes Cocoon is a dynamic publishing framework, but how dynamic a site would
> be.

Cocoon is a publishing framework (note the absence of the term dynamic).
So it means that some content are static, and do not depend on the
request data (no POST or GET parameters).

> Let's take an example of a typical site which serves output depending on
> the client. Site content is stored in xml. Most of the time maximum hit a
> site would get is the main page. Won't it make sense to just keep it stored
> in the requested format(html,wml etc.) and just check if the source xml has
> changed. External file inclusion makes more sense over here.

That's how Cocoon 2.0 cache should work. If all
producer/formatter/serializer in my construction chain report that their
bahaviour is not changed since last operation, then the cached content
is served, otherwise the page gets regenerated.

	Pier

-- 
--------------------------------------------------------------------
-          P              I              E              R          -
stable structure erected over water to allow the docking of seacraft
<ma...@betaversion.org>    <http://www.betaversion.org/~pier/>
--------------------------------------------------------------------
- ApacheCON Y2K: Come to the official Apache developers conference -
-------------------- <http://www.apachecon.com> --------------------