Fabio,

We're achieving a good cache result by using mod_proxy and its built in
proxy cache.

We have:
Front servers that do caching and backservers that runs the tomcat.

The fron servers runs apache and mod_proxy. Any request coming in to
example www.foo.com/index.jsp is proxied through to the back hosts where
another apache is listening on port 80. The apache on the back host uses
mod_jk to connect to Tomcat which serves the page.

mod_proxy on the fron hosts has a proxy cache which can be used to cache
our jsp pages. There are some simple rules to follow when you want a jsp
to be cached in a generic web cache (see HTTP protocol for details on
web caches).

We got it sorted so that a request that comes into the front hosts, will
only result in a revalidation (If-Modified-Since) to the back hosts. The
jsp page can be coded to deal with this type of request and can then
tell the front hosts to serve the cached page or return a new one.

Martin



> -----Original Message-----
> From: Fabio Salvi [mailto:[EMAIL PROTECTED]] 
> Sent: 29 January 2003 10:43
> To: [EMAIL PROTECTED]
> Subject: Ap..cache
> 
> 
> Hi all,
> 
> recently I've been thinking about a way to implement a cache 
> mechanism in Apache-Tomcat interaction (e.g. ajp13). I'd be 
> really grateful if you gave me some suggestions or advice on 
> the matter. Below I shortly describe what I've built as a 
> kind of prototype.
> 
> To sum up, I've modified mod_jk (win2000) in some points in 
> order to make it cache-aware. I've introduced in httpd.conf 
> the following directives:
> 
> #
> # normal jk directives
> #
> JkMount /*.jsp ajp13
> 
> #Cache extensions
> JkCache on
> JkCacheDirectory C:\cache
> 
> This is, basically, the collaboration diagram I've implemented:
> 
> .     mod_jk intercepts request for /pippo/cachetest.jsp;
> .     mod_jk asks Tomcat, at the moment actually a WebApp 
> controller, for a list of dirty items in cache folder;
> .     then, mod_jk deletes dirty-bit pages in the cache;
> .     now mod_jk manages current request. If it finds the 
> page in the cache it returns static file to Apache.
> .     Otherwise it requires the resource back to the WebApp 
> controller. The latter knows if the page is to be cached and  
> puts a special tag on the byte stream in response, after 
> having dynamically built it;
> .     mod_jk receives the response and if it does contain the 
> above mentioned tag, mod_jk writes it in the cache folder     
> before sending it to Apache. If there's a query string, it'll 
> include it in the static resource name.
> 
> The second and third steps are an overload respect to normal 
> interaction, but that permits to save a lot of elaborating 
> time and network roundtrips when you ask for a very heavy 
> resource (e.g a jsp which loads many non-volatile and quite 
> stable data from a db). All that seems to work 
> fine...According to your opinion is a worth-to-develop idea?
> 
> Thanks in advance for your advise!
> Fabio
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to