[Setup] Varnish cache does not appear to speed up page delivery

Ricardo Newbery ric at digitalmarbles.com
Wed Mar 4 14:36:02 UTC 2009


On Mar 4, 2009, at 6:17 AM, JimL wrote:

>
> Hi Ric,
>
>
> Ricardo Newbery-2 wrote:
>>
>>
>> Personally, I would examine response headers first before diving into
>> varnish stats and logs.  Both CacheFu and Varnish will add headers to
>> the response telling you what it's doing, whether it's getting the
>> content from cache or whether it's pulling it from the backend.  This
>> is usually all you need to know to diagnose 95% of cache issues.
>>
>>
>
> Response headers are:
>
> http://webstar.eng.ox.ac.uk:8000/IBME/IBME
>
> GET /IBME/IBME HTTP/1.1
> Host: webstar.eng.ox.ac.uk:8000
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv: 
> 1.9.0.6)
> Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/ 
> *;q=0.8
> Accept-Language: en-gb,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://webstar.eng.ox.ac.uk:8000/IBME/IBME
> Cookie: __utmz=####
> If-None-Match: ||IBME-MainTheme|en-gb;en;q=0.5|1|6509||||343382
>
> HTTP/1.x 304 Not Modified
> Server: Zope/(Zope 2.10.7-final, python 2.4.5, linux2) ZServer/1.1
> Plone/3.2.1
> Expires: Sun, 07 Mar 1999 14:10:14 GMT
> Vary: Accept-Encoding
> Etag: ||IBME-MainTheme|en-gb;en;q=0.5|1|6509||||343382
> X-Caching-Rule-Id: plone-content-types
> Cache-Control: max-age=0, s-maxage=0, private, must-revalidate
> X-Header-Set-Id: cache-in-memory
> Content-Length: 0
> Date: Wed, 04 Mar 2009 14:10:14 GMT
> X-Varnish: 1423877020
> Age: 0
> Via: 1.1 varnish
> Connection: keep-alive
> ----------------------------------------------------------
> http://webstar.eng.ox.ac.uk:8000/IBME/IBME/images/IBMEExterior.jpg/image_preview
>
> GET /IBME/IBME/images/IBMEExterior.jpg/image_preview HTTP/1.1
> Host: webstar.eng.ox.ac.uk:8000
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv: 
> 1.9.0.6)
> Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
> Accept: image/png,image/*;q=0.8,*/*;q=0.5
> Accept-Language: en-gb,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://webstar.eng.ox.ac.uk:8000/IBME/IBME
> Cookie: __utmz=####
> If-Modified-Since: Thu, 19 Feb 2009 15:34:52 GMT
>
> HTTP/1.x 304 Not Modified
> Date: Wed, 04 Mar 2009 14:10:14 GMT
> Via: 1.1 varnish
> X-Varnish: 1423877021
> Last-Modified: Thu, 19 Feb 2009 15:34:52 GMT
> Connection: keep-alive
> ----------------------------------------------------------
>
>> From this I assume that Varnish is indeed caching.
>
> Still, slower performance than I'd expect.
>
> Cheers,  Jim




You've got two different requests represented here.  Both are  
conditional requests (If-None-Match and If-Modified-Since) which tells  
me that you have both items cached in the browser and your browser is  
just revalidating both.  Neither response is delivering from the  
varnish cache, although the second is getting a validation response  
from varnish.

The first request is passed through to Plone and Plone response with a  
304 Not Modified response to your validation request.  The second  
request finds a cached entry in Varnish but also returns a 304 Not  
Modified response.

The Varnish header contains one or two numbers.  The first is just the  
id of the current transaction, the second only shows up if there is a  
delivery from the cache and it just shows the id of the previous  
transaction that put the item in the cache.  So if you have one  
number, no cache hit.

Ric








More information about the Setup mailing list