mod_cache questions

mod_cache questions

am 07.06.2002 11:48:06 von Arnauld Dravet

This is a multi-part message in MIME format.

------=_NextPart_000_001A_01C20E19.2FF87AE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,

As i didn't find any mailing list specific to mod_cache =
development/user-help i thought i could use this one as mod_cache was =
included in mod_proxy with Apache 1.3.

I have to implement cache support in our reverse proxy, running apache =
2.0.36 (Linux), and, as mod_proxy is not caching anymore, i'm checking =
which modules i could use, depending on their features.

Of course i've checked mod_cache, but also 'fcache'. Both don't have any =
complete documentations so i'm kinda stuck.

My questions about mod_cache:
- Can i use the cache (disk and/or ram based cache) in a virtual host =
based server ? Our reverse proxy is serving different internal sites, =
and we want to activate caching for a few sites, but not for all.

- Can i enable (or deny) the cache per URI (directories) and specific =
files (inside a virtual host) ? For example, can i use as default rule =
for a virtual host to not cache anything, except one directory =
containing static pages ?

- How the reverse proxy will act if i tell him to cache dynamic pages ? =
Is there an algorithm or anything used to determine if a page is static =
or dynamic ? (i'm gonna read RFC 2616 right now, i don't know yet if it =
talks about that).

Thank you for your answers, it will greatly help me ...

Arnauld Dravet
smurfie@egocentrique.com

------=_NextPart_000_001A_01C20E19.2FF87AE0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">




Hello,

 

As i didn't find any mailing list =
specific to=20
mod_cache development/user-help i thought i could use this one as =
mod_cache was=20
included in mod_proxy with Apache 1.3.

 

I have to implement cache support in =
our reverse=20
proxy, running apache 2.0.36 (Linux), and, as mod_proxy is not caching =
anymore,=20
i'm checking which modules i could use, depending on their=20
features.

 

Of course i've checked mod_cache, but =
also=20
'fcache'. Both don't have any complete documentations so i'm kinda=20
stuck.

 

My questions about =
mod_cache:

- Can i use the cache (disk and/or ram =
based cache)=20
in a virtual host based server ? Our reverse proxy is serving different =
internal=20
sites, and we want to activate caching for a few sites, but not for=20
all.

 

- Can i enable (or deny) the cache =
per URI=20
(directories) and specific files (inside a virtual host) ? For =
example, can=20
i use as default rule for a virtual host to not cache anything, =
except one=20
directory containing static pages ?

 

- How the reverse proxy will act if i =
tell him to=20
cache dynamic pages ? Is there an algorithm or anything used to =
determine if a=20
page is static or dynamic ? (i'm gonna read RFC 2616 right now, i don't =
know yet=20
if it talks about that).

 

Thank you for your answers, it will =
greatly help me=20
....

 

Arnauld Dravet

size=3D2>smurfie@egocentrique.com


------=_NextPart_000_001A_01C20E19.2FF87AE0--

Re: mod_cache questions

am 07.06.2002 12:38:54 von Graham Leggett

This is a cryptographically signed message in MIME format.

--------------ms41AA6BAB35DA7B62C3C51675
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Arnauld Dravet wrote:

> I have to implement cache support in our reverse proxy, running apache
> 2.0.36 (Linux), and, as mod_proxy is not caching anymore, i'm checking
> which modules i could use, depending on their features.

The caching was stripped from mod_proxy and moved into mod_cache.

> Of course i've checked mod_cache, but also 'fcache'. Both don't have
> any complete documentations so i'm kinda stuck.

Hmmm... must check what docs exist...

> My questions about mod_cache:
> - Can i use the cache (disk and/or ram based cache) in a virtual host
> based server ? Our reverse proxy is serving different internal sites,
> and we want to activate caching for a few sites, but not for all.

(AFAIK) yes.

The main reason the cache was ripped out of proxy was that we wanted
cache to work anywhere in Apache. For example with mod_cgi, or
mod_webapp (for tomcat).

> - Can i enable (or deny) the cache per URI (directories) and specific
> files (inside a virtual host) ? For example, can i use as default rule
> for a virtual host to not cache anything, except one directory
> containing static pages ?

Again, yes. Caching is enabled or disabled for content beneath a
specific URL, configurable by you.

> - How the reverse proxy will act if i tell him to cache dynamic pages
> ? Is there an algorithm or anything used to determine if a page is
> static or dynamic ? (i'm gonna read RFC 2616 right now, i don't know
> yet if it talks about that).

Again yes. RFC2616 explains how HTTP proxies and caches are supposed to
work - to HTTP there is no such thing as "static" or "dynamic", there is
only "content". Look for headers like Cache-Control, Etag, and the stuff
on conditional requests to see how this all works.

Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm "There's a moon
over Bourbon Street
tonight..."
--------------ms41AA6BAB35DA7B62C3C51675
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIIIAAYJKoZIhvcNAQcCoIIH8TCCB+0CAQExCzAJBgUrDgMCGgUAMAsGCSqG SIb3DQEHAaCC
Bf4wggLNMIICNqADAgECAgMHh88wDQYJKoZIhvcNAQEEBQAwgZIxCzAJBgNV BAYTAlpBMRUw
EwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEPMA0G A1UEChMGVGhh
d3RlMR0wGwYDVQQLExRDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEoMCYGA1UEAxMf UGVyc29uYWwg
RnJlZW1haWwgUlNBIDIwMDAuOC4zMDAeFw0wMjA1MjMxMzQzMDVaFw0wMzA1 MjMxMzQzMDVa
MIGAMRAwDgYDVQQEEwdMZWdnZXR0MQ8wDQYDVQQqEwZHcmFoYW0xFzAVBgNV BAMTDkdyYWhh
bSBMZWdnZXR0MR8wHQYJKoZIhvcNAQkBFhBtaW5mcmluQHNoYXJwLmZtMSEw HwYJKoZIhvcN
AQkBFhJtaW5mcmluQGFwYWNoZS5vcmcwgZ8wDQYJKoZIhvcNAQEBBQADgY0A MIGJAoGBAMu6
SGJLfqv2lRy+TAhi2K5KhF70x9RHqyptGfCBVgwOdRKcAfpmo8R9aqEjc829 cKBwrkiA5QHW
mTK9vXMtQ1kAwsK0woyFLN2dpvCqhxgUTYm7rKFJjMrISzuXnJT5y1R7zMgV bznUny0MQPWE
KtelO6UHV7gVHMIIUvKg+OSvAgMBAAGjQTA/MC8GA1UdEQQoMCaBEG1pbmZy aW5Ac2hhcnAu
Zm2BEm1pbmZyaW5AYXBhY2hlLm9yZzAMBgNVHRMBAf8EAjAAMA0GCSqGSIb3 DQEBBAUAA4GB
AFbZLPzEpllc/6aauUsRn99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0GCSqG SIb3DQEBBAUA
A4GBAHMbbyZli/8VNEtZYortRL5Jx+gNu4+5DWomKmKEH7iHY3QcbbfPGlOR S+HN5jjZ7VD0
Omw0kqzmkpxuwSMBwgmn70uuct0GZ/VQby5YuLYLwVBXtewc1+8XttWIm7ei iBrtOVs5fTT8
tpYYJU1q9J3Fw5EvqZa4BTxS/N3pYgNIMYIByjCCAcYCAQEwgZowgZIxCzAJ BgNVBAYTAlpB
MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEP MA0GA1UEChMG
VGhhd3RlMR0wGwYDVQQLExRDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEoMCYGA1UE AxMfUGVyc29u
YWwgRnJlZW1haWwgUlNBIDIwMDAuOC4zMAIDB4fPMAkGBSsOAwIaBQCggYYw GAYJKoZIhvcN
AQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMDIwNjA3MTAzODU1 WjAjBgkqhkiG
9w0BCQQxFgQUVDt8D4FI4NfZg+P8V2Zt/QOuqHswJwYJKoZIhvcNAQkPMRow GDAHBgUrDgMC
BzANBggqhkiG9w0DAgIBKDANBgkqhkiG9w0BAQEFAASBgIHTogVCaid2OsxO agQQmmbnzhCs
OA6CfF/Na+p7ahh2iCbE56WJAv7/mmS98GCqBXBfL2JfUjTneFlVUhBiPHe/ QRCQvSB7W/QD
ptFUK+HjZSa1ux/jxvLT+K1Jy8X42ESxlftyjU20GB5sFv1vLfim8zZu5dIn qhO2kCx+6HjP

--------------ms41AA6BAB35DA7B62C3C51675--

Re: mod_cache questions

am 07.06.2002 15:40:01 von Arnauld Dravet

Hi Graham and thanks for your help :)

I've began to check sources of mod_cache so at least i can see what
directives can be used for each submodule (disk & mem).
Will such an httpd.conf work (can't try it yet i'm not @work) ? A few
things i'm wondering are quoted after the listing.

----------------------------------
##general apache config
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so

##beginning of virtual hosts config
NameVirtualHost 192.168.100.19:80


ServerName web1.test.com
ProxyRequests on
ProxyPass / http://web1.test.com/
ProxyPassReverse / http://web1.test.com/

CacheOn On
CacheRoot /cache/web1 #directory in which we want to disk cache
this virtualhost
CacheSize 1000000 #approx 1GB of disk cache for this
virtualhost
CacheExpiryCheck On #we verify the expiration date of cached
objects
CacheMinFileSize 256000 #we disk cache objects of size >= approx 256KB
CacheMaxFileSize 10000000 #we disk cache objects of size <= approx 10MB
CacheGcUnused 2 #we erase unused cached objects every 2
hours

MCacheSize 64000 #approx 64MB allocated for memory cache
MCacheMinObjectSize 1 #we RAM cache objects of size >= 1 byte
MCacheMaxObjectSize 256000 #we RAM cache objects of size <= 256KBytes

TransferLog /dev/null
ErrorLog /logs/1-error.log



ServerName web2.test.com
ProxyRequests on
ProxyPass / http://web2.test.com/
ProxyPassReverse / http://web2.test.com/


CacheEnable mem / #we ram cache the root dir of web2
CacheEnable disk /pictures #we disk cache
http://web2.test.com/bigfiles/*
CacheEnable mem /bigfiles/thumbnails #we ram cache
http://web2.test.com/bigfiles/thumbnails/*

CacheRoot /cache/web2 #directory in which we want to disk cache
this virtualhost
CacheSize 500000 #approx 500MB of cache for this
virtualhost
CacheExpiryCheck Off #we don't verify the expiration date of
cached objects
CacheMinFileSize 128000 #we disk cache objects of size >= approx
128KB
CacheMaxFileSize 10000000 #we disk cache objects of size <= approx 10MB
CacheGcUnused 5 #we erase unused cached objects every 5
hours

MCacheSize 128000 #approx 128MB allocated for memory cache
MCacheMinObjectSize 1 #we RAM cache objects of size >= 1 byte
MCacheMaxObjectSize 128000 #we RAM cache objects of size <= 128KB

TransferLog /dev/null
ErrorLog /logs/2-error.log


-------------------
QUESTIONS ABOUT THIS EXAMPLE:
- Is it better to use CacheOn On in the global section, and tell in each
VirtualHost i don't want to activate caching CaheOn Off, or should i do like
i did, explicitely use CacheOn On in the VirtualHosts i want to cache ?
- Can i still use CacheEnable if i also use
CacheOn On/Off, in the same VirtualHost ?
- Should i better use CacheOn On ... or
CacheOn On ...
to enable cache per directory/location, instead
of using several CacheEnable inside a VirtualHost declaration?
- What happen if CacheMinFileSize < MCacheMaxObjectSize in my example ? Will
mod_cache automatically take the cached object in RAM, which should be
accessed faster than on disk ?
- Finally, is there a way to enable or disable cache per file extension ? ie
deny cache on all files like .php .cgi .asp or requests using an URL with
parameters (using the '?' character) ?





Thank you again ....
Arnauld

--
Arnauld Dravet
smurfie@egocentrique.com