Caching issue
Shain Miley
smiley at npr.org
Fri Mar 7 23:24:48 CET 2008
Adrian,
Thanks for the info...here is the output from my request (ip's
changed)..in case this can shed some light on things:
0 CLI Rd ping
0 CLI Wr 0 200 PONG 1204928472
0 WorkThread 0x66b1d1b0 start
12 SessionOpen c 172.1.1.1 3690
0 WorkThread 0x6531d1b0 end
12 ReqStart c 172.1.1.1 3690 84896454
12 RxRequest c GET
12 RxURL c /index.html
12 RxProtocol c HTTP/1.1
12 RxHeader c Accept: image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint,
application/msword, application/x-shockwave-flash, */*
12 RxHeader c Accept-Language: en-us
12 RxHeader c UA-CPU: x86
12 RxHeader c Accept-Encoding: gzip, deflate
12 RxHeader c User-Agent: Mozilla/4.0 (compatible; MSIE 7.0;
Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
12 RxHeader c Host: host.xxx.com:8080
12 RxHeader c Connection: Keep-Alive
12 RxHeader c Cookie: v1st=9771DC737ED120FD;
GUID=000CD0009ECB070B15D1037761626364
12 VCL_call c recv
12 VCL_return c lookup
12 VCL_call c hash
12 VCL_return c hash
12 VCL_call c miss
12 VCL_return c fetch
12 Length c 455
12 VCL_call c deliver
12 VCL_return c deliver
12 TxProtocol c HTTP/1.1
12 TxStatus c 503
12 TxResponse c Service Unavailable
12 TxHeader c Server: Varnish
12 TxHeader c Retry-After: 30
12 TxHeader c Content-Type: text/html; charset=utf-8
12 TxHeader c Content-Length: 455
12 TxHeader c Date: Fri, 07 Mar 2008 22:21:14 GMT
12 TxHeader c X-Varnish: 84896454
12 TxHeader c Age: 0
12 TxHeader c Via: 1.1 varnish
12 TxHeader c Connection: keep-alive
12 ReqEnd c 84896454 1204928473.923037052 1204928474.937938929
0.004235029 1.014863968 0.000037909
0 StatAddr 172.1.1.1 0 5172 23 249 0 0 11 63867 204568
0 CLI Rd ping
0 CLI Wr 0 200 PONG 1204928475
Shain
Adrian Otto wrote:
> Shain,
>
> I can't say for certain without looking at it myself, but I wonder if
> when you request the URL from the second machine using firefox you are
> actually doing a "refresh" that's setting a Cache-Control header
> that's forcing varnish to consult the origin server. I suggest
> connecting to your varnish with "varnishlog" and watching the headers
> that each client sends varnish. If you see headers like this:
>
> 13 RxHeader c Pragma: no-cache
> 13 RxHeader c Cache-Control: no-cache
>
> Then you know that's what's happening. In general, it sounds like you
> are looking for an "off-line" mode where the cache server simply
> serves stale content if an origin server can not be reached. If that
> feature is present in varnish, I'm not aware of it.
>
> Adrian
>
>
> On Mar 7, 2008, at 1:10 PM, Shain Miley wrote:
>
>> Hello all,
>> First let me say thanks to everyone for taking time to work on this
>> project...I am still in the testing phase, however if all goes well
>> Varnish is going to come in quite handy.
>>
>> So here is my problem:
>>
>> I would like to use varnish to cache urls for say a period of 30
>> minutes. The caching seems fine as long as I use the same browser to
>> request the url. But I am looking for a stop gap solution at this time
>> so in the event that the web server becomes unavailable....varnish can
>> serve the docs for a little while, so we can get things back in order.
>> Anyway..as it stands right now..I can request a url from wget or GET or
>> firefox... and turn off the webserver and I can refresh the page and all
>> is well.
>>
>> What I cannot do...is request a url using GET on one machine..then stop
>> the webserver and request that same url from firefox (different machine)
>> and get a valid page...I get a 503 error...Here is the vcl.conf file
>> (which I took most of from the web) I am using:
>>
>> Any help would be great!
>>
>> Thanks,
>>
>> Shain
>>
>> sub vcl_recv {
>> if (req.request != "GET" && req.request != "HEAD") {
>> # PURGE request if zope asks nicely
>> if (req.request == "PURGE") {
>> if (!client.ip ~ purge) {
>> error 405 "Not allowed.";
>> }
>> lookup;
>> }
>> pipe;
>> }
>> if (req.http.Expect) {
>> pipe;
>> }
>>
>> if (req.http.Authenticate || req.http.Authorization) {
>> pass;
>> }
>>
>> # We only care about the "__ac.*" cookies, used for
>> authentication
>> if (req.http.Cookie && req.http.Cookie ~
>> "__ac(|_(name|password|persistent))=") {
>> pass;
>> }
>>
>> # File type that we will always cache
>> if (req.request == "GET" && req.url ~
>> "\.(html|php|gif|jpg|swf|css|js|png|jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|js|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar)$")
>>
>> {
>> lookup;
>> }
>>
>> if (req.request == "POST") {
>> pipe;
>> }
>>
>> # force lookup even when cookies are present
>> if (req.request == "GET" && req.http.cookie) {
>> lookup;
>> }
>> lookup;
>> }
>>
>> sub vcl_fetch {
>>
>> if (obj.ttl < 1800) {
>> set obj.ttl = 1800s;
>> }
>> }
>>
>> # Do the PURGE thing
>> sub vcl_hit {
>> if (req.request == "PURGE") {
>> set obj.ttl = 0s;
>> error 200 "Purged";
>> }
>> }
>>
>> sub vcl_miss {
>> if (req.request == "PURGE") {
>> error 404 "Not in cache";
>> }
>> }
>>
>>
>>
>> _______________________________________________
>> varnish-dev mailing list
>> varnish-dev at projects.linpro.no
>> http://projects.linpro.no/mailman/listinfo/varnish-dev
>
>
More information about the varnish-dev
mailing list