Forum Moderators: phranque

Message Too Old, No Replies

mod cache on dynamic backend

question dynamic backends with mod_cache proxying them

         

pmarsh

11:24 pm on Jan 3, 2007 (gmt 0)

10+ Year Member



I'm trying to get a mod_disk_cache setup to proxy the content generated by a proxy-balanced backend but am running into some problems.

Here is a snip of the .conf

################ CONF ####################
IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
UseCanonicalName On
CacheRoot /pagecache
CacheEnable disk /
CacheDisable /image_assets
CacheDisable /images
CacheDisable /pictures
CacheDisable /flash
CacheIgnoreNoLastMod On
CacheIgnoreCacheControl Off
CacheIgnoreHeaders Set-Cookie
CacheDefaultExpire 360
CacheDirLevels 2
CacheDirLength 1
</IfModule>
</IfModule>

<Proxy balancer://sitev2_cluster>
ExpiresActive On
ExpiresDefault A86400
ExpiresByType application/xml A600
ExpiresByType text/xml A300
ExpiresByType text/html A300
ExpiresByType image/x-icon A2592000
ExpiresByType text/javascript A644800
ExpiresByType text/css A644800
ExpiresByType image/gif A604800
ExpiresByType image/png A604800
ExpiresByType image/jpeg A604800
ExpiresByType application/x-shockwave-flash A604800
ExpiresByType video/x-flv A604800
ExpiresByType application/pdf A604800
Header set Cache-Control "must-revalidate"
Header unset Vary
BalancerMember [127.0.0.1:7000...]
BalancerMember [127.0.0.1:7001...]
BalancerMember [127.0.0.1:7002...]
</Proxy>

ProxyPass / balancer://sitev2_cluster/
ProxyPassReverse / balancer://sitev2_cluster/
ProxyRequests Off

################ END CONF ####################

Now files are being written to /pagecache so it appears to work until you look at the headers and log that the backend generates. It seems that it still gets hit for content that should be cached. For example the homepage will show up as being requested in the backend logs at 05:00 that should then be picked up and used by Apache for 5minutes right?

Instead I'll see more requests for it at 05:10 05:30 06:00 etc. Does Apache check with the backend for some reason before serving up the cached version?

The backend doesn't write files itself but does return a Content-Type: for text/html or application/xml whatever is appropriate.

Anyone having any experience with this type of setup I'd really appreciate hearing from you.

pmarsh

2:44 pm on Jan 4, 2007 (gmt 0)

10+ Year Member



I meant my times to be represent MM:SS not HH:MM in case anyone thought of that.

pmarsh

4:48 pm on Jan 4, 2007 (gmt 0)

10+ Year Member



I believe I found the problem. I had several ServerAliases for this domain set.

The mod_cache would only cache the results when the site was called from the main ServerName address. Creating seperate virtualhost files for each alias solved the problem. Although not ideal.

Any confirmation on this?

jdMorgan

6:38 pm on Jan 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Based on the number of responses, I think you're now the local expert on this subject. :)

Thank you for posting your results though, as this may be quite helpful to future readers as development of this module proceeds and deployment becomes more widespread.

Thanks,
Jim