Cacheability - changed in Varnish 2?

Anton Stonor stonorn at giraffen.dk
Thu Jan 29 01:27:04 CET 2009


Hi Poul-Henning,


>>     9 VCL_call     c hash
>>     9 VCL_return   c hash
>>     9 HitPass      c 1998529216
>>     9 VCL_call     c pass
>>     9 VCL_return   c pass
> 
> This is the important bit, you have a cached object that says this
> object cannot be cached, but should be passed.

Thanks for digging into this and pointing out the relevant part. I see 
that my log-snippets wasn't that useful to nail the issue.

New try. First, a request with no expire or cache-control header.

     9 RxURL        c /test_varnish_noheader
     9 RxProtocol   c HTTP/1.1
     9 RxHeader     c Host: localhost:8000
     9 RxHeader     c User-Agent: Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5
     9 RxHeader     c Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
     9 RxHeader     c Accept-Language: en-us,en;q=0.5
     9 RxHeader     c Accept-Encoding: gzip,deflate
     9 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
     9 RxHeader     c Keep-Alive: 300
     9 RxHeader     c Connection: keep-alive
     9 VCL_call     c recv
     9 VCL_return   c lookup
     9 VCL_call     c hash
     9 VCL_return   c hash
     9 VCL_call     c miss
     9 VCL_return   c fetch
    10 BackendOpen  b backend_0 127.0.0.1 36975 127.0.0.1 8080
     9 Backend      c 10 backend_0 backend_0
    10 TxRequest    b GET
    10 TxURL        b /test_varnish_noheader
    10 TxProtocol   b HTTP/1.1
    10 TxHeader     b Host: localhost:8000
    10 TxHeader     b User-Agent: Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5
    10 TxHeader     b Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    10 TxHeader     b Accept-Language: en-us,en;q=0.5
    10 TxHeader     b Accept-Encoding: gzip,deflate
    10 TxHeader     b Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    10 TxHeader     b X-Varnish: 1495399095
    10 TxHeader     b X-Forwarded-For: 127.0.0.1
    10 RxProtocol   b HTTP/1.1
    10 RxStatus     b 200
    10 RxResponse   b OK
    10 RxHeader     b Server: Zope/(Zope 2.10.6-final, python 2.4.5, 
linux2) ZServer/1.1 Plone/3.1.5.1
    10 RxHeader     b Date: Thu, 29 Jan 2009 00:10:40 GMT
    10 RxHeader     b Content-Length: 4
    10 RxHeader     b Content-Type: text/plain; charset=utf-8
     9 ObjProtocol  c HTTP/1.1
     9 ObjStatus    c 200
     9 ObjResponse  c OK
     9 ObjHeader    c Server: Zope/(Zope 2.10.6-final, python 2.4.5, 
linux2) ZServer/1.1 Plone/3.1.5.1
     9 ObjHeader    c Date: Thu, 29 Jan 2009 00:10:40 GMT
     9 ObjHeader    c Content-Type: text/plain; charset=utf-8
    10 BackendReuse b backend_0
     9 TTL          c 1495399095 RFC 0 1233187840 0 0 0 0
     9 VCL_call     c fetch
     9 TTL          c 1495399095 VCL 86400 1233187841
     9 VCL_return   c pass
     9 Length       c 4
     9 VCL_call     c deliver
     9 VCL_return   c deliver


"pass" is called inside vcl_fetch because the object is classified as 
!cachable. Subsequent requests gives same result as in my first mail:

     9 VCL_call     c recv
     9 VCL_return   c lookup
     9 VCL_call     c hash
     9 VCL_return   c hash
     9 HitPass      c 1495399095
     9 VCL_call     c pass
     9 VCL_return   c pass
     9 Backend


Then, restart Varnish, same vcl file, same backend reponse except that 
we are now adding a cache-control header:


   9 RxRequest    c GET
     9 RxURL        c /test_varnish
     9 RxProtocol   c HTTP/1.1
     9 RxHeader     c Host: localhost:8000
     9 RxHeader     c User-Agent: Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5
     9 RxHeader     c Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
     9 RxHeader     c Accept-Language: en-us,en;q=0.5
     9 RxHeader     c Accept-Encoding: gzip,deflate
     9 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
     9 RxHeader     c Keep-Alive: 300
     9 RxHeader     c Connection: keep-alive
     9 VCL_call     c recv
     9 VCL_return   c lookup
     9 VCL_call     c hash
     9 VCL_return   c hash
     9 VCL_call     c miss
     9 VCL_return   c fetch
    10 BackendOpen  b backend_0 127.0.0.1 38871 127.0.0.1 8080
     9 Backend      c 10 backend_0 backend_0
    10 TxRequest    b GET
    10 TxURL        b /test_varnish
    10 TxProtocol   b HTTP/1.1
    10 TxHeader     b Host: localhost:8000
    10 TxHeader     b User-Agent: Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5
    10 TxHeader     b Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    10 TxHeader     b Accept-Language: en-us,en;q=0.5
    10 TxHeader     b Accept-Encoding: gzip,deflate
    10 TxHeader     b Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    10 TxHeader     b X-Varnish: 1198489031
    10 TxHeader     b X-Forwarded-For: 127.0.0.1
    10 RxProtocol   b HTTP/1.1
    10 RxStatus     b 200
    10 RxResponse   b OK
    10 RxHeader     b Server: Zope/(Zope 2.10.6-final, python 2.4.5, 
linux2) ZServer/1.1 Plone/3.1.5.1
    10 RxHeader     b Date: Thu, 29 Jan 2009 00:20:42 GMT
    10 RxHeader     b Content-Length: 4
    10 RxHeader     b Content-Type: text/plain; charset=utf-8
    10 RxHeader     b Cache-Control: max-age=1
     9 ObjProtocol  c HTTP/1.1
     9 ObjStatus    c 200
     9 ObjResponse  c OK
     9 ObjHeader    c Server: Zope/(Zope 2.10.6-final, python 2.4.5, 
linux2) ZServer/1.1 Plone/3.1.5.1
     9 ObjHeader    c Date: Thu, 29 Jan 2009 00:20:42 GMT
     9 ObjHeader    c Content-Type: text/plain; charset=utf-8
     9 ObjHeader    c Cache-Control: max-age=1
    10 BackendReuse b backend_0
     9 TTL          c 1198489031 RFC 1 1233188442 0 0 1 0
     9 VCL_call     c fetch
     9 TTL          c 1198489031 VCL 86400 1233188443
     9 VCL_return   c deliver
     9 Length       c 4
     9 VCL_call     c deliver
     9 VCL_return   c deliver
     9 TxProtocol   c HTTP/1.1
     9 TxStatus     c 200
     9 TxResponse   c OK
     9 TxHeader     c Server: Zope/(Zope 2.10.6-final, python 2.4.5, 
linux2) ZServer/1.1 Plone/3.1.5.1
     9 TxHeader     c Content-Type: text/plain; charset=utf-8
     9 TxHeader     c Cache-Control: max-age=1
     9 TxHeader     c Content-Length: 4
     9 TxHeader     c X-Varnish-Action: FETCH (insert)
     9 TxHeader     c Date: Thu, 29 Jan 2009 00:20:42 GMT
     9 TxHeader     c X-Varnish: 1198489031
     9 TxHeader     c Age: 0
     9 TxHeader     c Via: 1.1 varnish


Subsequent requests gives a cache hit (and respects my obj.tt value):

    9 RxRequest    c GET
     9 RxURL        c /test_varnish
     9 RxProtocol   c HTTP/1.1
     9 RxHeader     c Host: localhost:8000
     9 RxHeader     c User-Agent: Mozilla/5.0 (X11; U; Linux i686; 
en-US; rv:1.9.0.5) Gecko/2008121622 Ubuntu/8.10 (intrepid) Firefox/3.0.5
     9 RxHeader     c Accept: 
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
     9 RxHeader     c Accept-Language: en-us,en;q=0.5
     9 RxHeader     c Accept-Encoding: gzip,deflate
     9 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
     9 RxHeader     c Keep-Alive: 300
     9 RxHeader     c Connection: keep-alive
     9 VCL_call     c recv
     9 VCL_return   c lookup
     9 VCL_call     c hash
     9 VCL_return   c hash
     9 Hit          c 1198489031
     9 VCL_call     c hit
     9 VCL_return   c deliver
     9 Length       c 4
     9 VCL_call     c deliver
     9 VCL_return   c deliver
     9 TxProtocol   c HTTP/1.1
     9 TxStatus     c 200
     9 TxResponse   c OK
     9 TxHeader     c Server: Zope/(Zope 2.10.6-final, python 2.4.5, 
linux2) ZServer/1.1 Plone/3.1.5.1
     9 TxHeader     c Content-Type: text/plain; charset=utf-8
     9 TxHeader     c Cache-Control: max-age=1
     9 TxHeader     c Content-Length: 4
     9 TxHeader     c X-Varnish-Action: HIT (deliver - from cache)
     9 TxHeader     c Date: Thu, 29 Jan 2009 00:22:26 GMT
     9 TxHeader     c X-Varnish: 1198489032 1198489031
     9 TxHeader     c Age: 104



I haven't had any luck to get objects without proper "cache-control" or 
"expires" to cache. Hope there is a workaround.

/Anton



More information about the varnish-misc mailing list