httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Woodworth" <mirkp...@gmail.com>
Subject [users@httpd] Getting mod_perl to run after mod_cache with Apache 2.2.6
Date Thu, 29 Nov 2007 16:05:27 GMT
Hi Folks,

I originally posted this message on the mod_perl mailing list, but I
did not receive any responses, so I'm posting here in the hopes that
someone can help me out.

My current LAMP stack is using Apache 2.0.54 and mod_perl 2.0.0-RC4,
and I'm doing something very much like what is mentioned in a previous
mod_perl mailing list post from 2 years ago, the thread of which can
be seen here:

http://www.gossamer-threads.com/lists/modperl/modperl/79672

In summary (taking from the above posting), here's a simple flow of
what we have happening:

1 - mod_cache [..got valid content in cache? If so, go to 4; if not, go to 2]
2 - mod_proxy [fetch content from origin web]
3 - mod_cache [content cacheable? If so, cache it locally]
4 - *MY FILTER*
5 - deflate

Using the same modifications mentioned in the above posting, we were
able to get mod_cache to run *before* mod_perl by changing mod_cache.c
so that the CACHE_SAVE and CACHE_OUT filters hook in at
AP_FTYPE_CONTENT_SET-2, and changing mod_perl.c so that mod_perl hooks
in at AP_FTYPE_CONTENT_SET-1. This solution is mentioned at the
bottom of the above posting.

But now I am upgrading our LAMP stack to Apache 2.2.6 and mod_perl
2.0.3, and I'm having trouble getting the above flow to work.

First off, mod_cache.c has changed so that instead of just CACHE_SAVE
and CACHE_OUT, there are also CACHE_SAVE_SUBREQ and CACHE_OUT_SUBREQ.
I'm not sure what the subrequests are really for, but here's what I've
been doing to try to get my desired flow to work:

The original Apache 2.2.6 filter order for mod_cache is:
CACHE_SAVE = AP_FTYPE_CONTENT_SET+1
CACHE_SAVE_SUBREQ = AP_FTYPE_CONTENT_SET-1
CACHE_OUT = AP_FTYPE_CONTENT_SET+1
CACHE_OUT_SUBREQ = AP_FTYPE_CONTENT_SET-1

The original mod_perl 2.0.3 filter order is:
MODPERL_REQUEST_OUTPUT = AP_FTYPE_RESOURCE

I've modified these to be:

Modified Apache 2.2.6 filter order for mod_cache:
CACHE_SAVE = AP_FTYPE_CONTENT_SET-2
CACHE_SAVE_SUBREQ = AP_FTYPE_CONTENT_SET-3
CACHE_OUT = AP_FTYPE_CONTENT_SET-2
CACHE_OUT_SUBREQ = AP_FTYPE_CONTENT_SET-3

Modified mod_perl 2.0.3 filter order:
MODPERL_REQUEST_OUTPUT = AP_FTYPE_CONTENT_SET-1

These modifications make it (theoretically from what I understand
about the filtering order numbers and my experience with the older
Apache and mod_perl) so that mod_perl runs after mod_cache, in the
same way that I was able to do this for Apache 2.0.54 and mod_perl
2.0.0-RC4. However it is not working as I expected -- mod_cache
appears to not be returning the body of the content before my mod_perl
filter is run. So the user hits the site, mod_cache sees the page is
cached, mod_perl is run but doesn't see any content, only the headers,
then somewhere down the line mod_cache must be serving up the cached
content after mod_perl.

So, I'm stumped. Can anyone point me in the right direction?

Thanks!

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message