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]

Reply via email to