Hi Ori

On Wed, Mar 19, 2003 at 04:14:45PM +0200, Ori Tend wrote:
> Hi again Harry, 
> 
> Just wanted to let you know you've helped me :-)
> It really was the case- I chown-ed the cache directory to user nobody,
> and apached started to fill it with some files... I assumed that it
> should be the same owner as the owner of the other apache log files.. I
> assumed wrong :-)

Glad this helped. I remember bumping into this as well ...

> 
> I have another question, though- it looks like apache doesn't cache the
> dynamic info that tomcat generates (tomcat is connected via mod_jk). Any
> idea why? I also tried to enable mod_proxy, but it didn't help- tomcat
> still receives the same requests again and again, even though apache is
> supposed to cache it...

The way I understand it:
mod_cache caches according to the HTTP RFC, which means that the back-end
ought to provide appropriate headers that help the cache determine how
long it should cache the data.
If the backend does not provide any such headers (expire, last-modified),
the cache doesn't cache, especially if the URL contains a query string.

At work I recently ran into a similar problem. (Pseudo-) dynamic back-end
content with no such cache-friendly headers *had* to be cached (or our
site would performance crash) and we modified a 2.0.44 vanilla Apache to
serve our needs. Since most changes are a rather quick hack and since they
violate the RFC, I did not dare to propose them to the list but feel free
to use them (they should be attached to this mail). You would patch like

#!/bin/sh -ex
DIRECTORY=httpd-2.0.44
files_to_patch="mod_cache.c mod_disk_cache.c"
path_to_files="${DIRECTORY}/modules/experimental"
for file in $files_to_patch
do
        patch ${path_to_files}/$file < ${file}.diff
done
exit 0

before doing the make to compile.

The patch also enables that URLs ending with a / are cached.

Cheers - Harry

> 
> Thanks,
> Ori.
> 
> -----Original Message-----
> From: Ori Tend [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, March 16, 2003 8:03 PM
> To: 'harald deppeler'
> Subject: RE: mod_disk_cache problem
> 
> 
> Hi Harry,
> 
> First off, thanks for your reply :-)
> /usr/local/apache2/proxy owned by root- and I run apache always as root
> (also, all of apache's other directories are owned by root, so I assume
> this is ok for apache).
> 
> I tried to play with the CacheDefaultExpire, hoping that is the reason
> why apache didn't write anything to the CacheRoot directory, but it
> didn't help- apache doesn't write anything to that directory...
> 
> I kind of suspect it has to do with a compilation option I didn't set or
> so... But I really don't know which...
> 
> Ori.
> 
> 
> -----Original Message-----
> From: harald deppeler [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, March 16, 2003 7:10 PM
> To: Ori Tend
> Subject: Re: mod_disk_cache problem
> 
> 
> On Sun, Mar 16, 2003 at 04:03:35PM +0200, Ori Tend wrote:
> >  
> > I'm using apache standard cache configuration (loading 
> > mod_disk_cache). Yet for some reason, apache doesn't write anything to
> 
> > the CacheRoot dir. Just to make sure I didn't do anything wrong, I
> > reinstalled apache
> > again- this time on Win32, and using
> > the exact same cache configuration apache cached all the urls, as it
> > should have.
> >  
> > Just to make sure it doesn't have to do with mod_jk2 and tomcat 
> > connectivity, I tried to see if apache caches static content (html 
> > files which are not served by tomcat) - and apache didn't cache those 
> > as well.
> >  
> > any help would be greatly appreciated...
> >  
> >  
> > my httpd.conf (all is default, commented in the following):
> >  
> > LoadModule cache_module modules/mod_cache.so
> > LoadModule disk_cache_module modules/mod_disk_cache.so
> >  
> > CacheRoot "/usr/local/apache2/proxy"
> > CacheSize 5
> > CacheGcInterval 4
> > CacheMaxExpire 24
> > CacheLastModifiedFactor 0.1
> > CacheDefaultExpire 1
> > CacheEnable disk /
> 
> Is "/usr/local/apache2/proxy" writable by the httpd UID?
> 
> Does your backend service generate HTTP headers that set the caching
> expiry time? If not, your default expiry time would be 1 second. Is that
> really what you want?
> 
> If any of this helps, please post the solution to the list.
> 
> Cheers - Harry
> 
> 
> 
98a99
>     char *query = uri.query; /* HD: added */
115c116,125
<     if (!(types = ap_cache_get_cachetype(r, conf, path))) {
---
> 
>     /* HD: changed 3rd arg 'path' to 'url' 
>      * this will check the the cache type for the URL with query string
>      * (instead of just checking the path part)
>      *
>      * Also added a logger statement.
>      */
>     if (!(types = ap_cache_get_cachetype(r, conf, url))) {    
>         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
>                         "cache: URL with path %s and query string %s (url %s) is not 
> handled by cache.", path, query, url);
128c138,139
<     if (url[urllen-1] == '/') {
---
>     /* HD: commented the following block in order to also cache URL ending in '/' */
>     /* if (url[urllen-1] == '/') {
130c141
<     }
---
>     }*/
532c543,547
<     else if (r->args && exps == NULL) {
---
>     /* HD: commented out the following block in order to cache responses
>      * to CGI requests that don't provide an expiration time 
>      * (although this violates the RFC!) */
> 
>     /*HD else if (r->args && exps == NULL) { HD*/
536,537c551,552
<         reason = "Query string present but no expires header";
<     }
---
>         /*HD reason = "Query string present but no expires header"; 
>     } HD*/
339a340,355
>     /* HD: 
>      * copied and adapted this from mod_mem_cache.c as the length doesn't seem
>      * to be determined at this stage of the request. The length is set to the
>      * maximum file size we cache 
>      */ 
> 
>     if (len == -1) {
>         /* Caching a streaming response. Assume the response is
>          * less than or equal to max_streaming_buffer_size. We will
>          * correct all the cache size counters in write_body once
>          * we know exactly know how much we are caching.
>          */
>         len = conf->maxfs; 
>     }
> 
> 
342c358
<                      "cache_disk: URL %s failed the size check, "
---
>                      "cache_disk: URL %s failed the size check (%d), "
344c360
<                      key);
---
>                      key, len); /* HD: also log lenght */

Reply via email to