Caching issue

Shain Miley SMiley at npr.org
Sun Mar 9 00:02:41 CET 2008


Fair enough..here you go:

I used Firefox and IE from the same machine:

First the cache hit:

   12 SessionOpen  c 172.1.1.1 3203
   12 ReqStart     c 172.1.1.1 3203 42332617
   12 RxRequest    c GET
   12 RxURL        c /templates/topics/topic.php?topicId=1006
   12 RxProtocol   c HTTP/1.1
   12 RxHeader     c Host: server11.npr.org:8080
   12 RxHeader     c User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
   12 RxHeader     c Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=$
   12 RxHeader     c Accept-Language: en-us,en;q=0.5
   12 RxHeader     c Accept-Encoding: gzip,deflate
   12 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
   12 RxHeader     c Keep-Alive: 300
   12 RxHeader     c Connection: keep-alive
   12 RxHeader     c Cookie: v1st=7ED84E9096FDA5B; GUID=0003D141E48D07D140F1C40561626364
   12 RxHeader     c If-None-Match: "jpd--899294354.37421"
   12 VCL_call     c recv
   12 VCL_return   c lookup
   12 VCL_call     c hash
   12 VCL_return   c hash
   12 Hit          c 42332555
   12 VCL_call     c hit
   12 VCL_return   c deliver
   12 Length       c 9137
   12 VCL_call     c deliver
   12 VCL_return   c deliver
   12 TxProtocol   c HTTP/1.1
   12 TxStatus     c 200
   12 TxResponse   c OK
   12 TxHeader     c Server: Apache
   12 TxHeader     c X-Powered-By: PHP/5.2.3
   12 TxHeader     c X-Cache: jpcache vv2 - npr-burn
   12 TxHeader     c ETag: "jpd--899294354.37421"
   12 TxHeader     c Cache-Control: max-age=0
   12 TxHeader     c Expires: Sat, 08 Mar 2008 22:41:22 GMT
   12 TxHeader     c Vary: Accept-Encoding
   12 TxHeader     c Content-Encoding: gzip
   12 TxHeader     c Content-Encoding: gzip
   12 TxHeader     c Content-Type: text/html
   12 TxHeader     c Content-Length: 9137
   12 TxHeader     c Date: Sat, 08 Mar 2008 22:43:05 GMT
   12 TxHeader     c X-Varnish: 42332617 42332555
   12 TxHeader     c Age: 102
   12 TxHeader     c Via: 1.1 varnish
   12 TxHeader     c Connection: keep-alive
   12 ReqEnd       c 42332617 1205016185.289316893 1205016185.289417028 0.006116867 0.000038147 0.000061989


Now the cache miss:

12 SessionOpen  c 172.1.1.1 3211
   12 ReqStart     c 172.1.1.1 3211 42332632
   12 RxRequest    c GET
   12 RxURL        c /templates/topics/topic.php?topicId=1006
   12 RxProtocol   c HTTP/1.1
   12 RxHeader     c Accept: */*
   12 RxHeader     c Accept-Language: en-us
   12 RxHeader     c Accept-Encoding: gzip, deflate
   12 RxHeader     c User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
   12 RxHeader     c Host: server11.npr.org:8080
   12 RxHeader     c Connection: Keep-Alive
   12 RxHeader     c Cookie: v1st=2E524136463554A; GUID=000748BD59C807AC295102B561626364; LE4=+5SoM6V421+314+4
   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: Sat, 08 Mar 2008 22:43:15 GMT
   12 TxHeader     c X-Varnish: 42332632
   12 TxHeader     c Age: 0
   12 TxHeader     c Via: 1.1 varnish
   12 TxHeader     c Connection: keep-alive
   12 ReqEnd       c 42332632 1205016194.493165016 1205016195.508080959 0.005739927 1.014875889 0.000040054


And here is the current vcl.conf:

#
# This is a basic VCL configuration file for varnish.  See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# $Id: default.vcl 1929 2007-08-29 15:37:59Z des $
#

# Default backend definition.  Set this to point to your content
# server.

backend default {
set backend.host = "172.31.2.61"; // use your own backend ip address
set backend.port = "80"; // use your own backend port
}

sub vcl_recv {

  # Remove the "Cookie:" header from the request.
  remove req.http.Set-Cookie;
  remove req.http.Cache-Control;


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)$") {
            lookup;
        }

if (req.http.Cache-Control ~ "no-cache") {
       lookup;
}
if (req.http.Cache-Control == "max-age=0") {
       lookup;
}
  # Do a "lookup" in the cache.  This goes to "vcl_hit", or to
  # "vcl_miss" and then "vcl_fetch"
  lookup;
}

# Do the PURGE thing
sub vcl_hit {
}
sub vcl_miss {
}

sub vcl_fetch {
if (obj.ttl < 7200s) {
set obj.ttl = 7200s;
        }
insert;

 if (obj.http.Pragma ~ "no-cache" || obj.http.Cache-Control ~ "no-cache" || obj.http.Cache-Control ~ "max-age=0") {
        insert;
        }

  if (obj.ttl < 3600s) {
    set obj.ttl = 3600s;
  }
insert;
}

sub vcl_hash {

set req.hash += req.url;
hash;
}


Thanks,

Shain

-----Original Message-----
From: Dag-Erling Smørgrav [mailto:des at linpro.no]
Sent: Sat 3/8/2008 10:58 AM
To: Shain Miley
Cc: Adrian Otto; varnish-dev at projects.linpro.no
Subject: Re: Caching issue
 
Shain Miley <smiley at npr.org> writes:
> Thanks for the info...here is the output from my request (ip's
> changed)..in case this can shed some light on things:

This is useless if you don't also show us a request that worked.

DES
-- 
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20080308/32b20cfc/attachment-0001.html>


More information about the varnish-dev mailing list