First request is always a miss (per client)
Kristian Lyngstol
kristian at varnish-software.com
Fri Nov 19 07:50:19 CET 2010
On Thu, Nov 18, 2010 at 05:38:24PM +0100, Frederik Schumacher wrote:
> I'm running a Pressflow site on a LAMP with Apache on port 8080 and
> Varnish on port 80. My problem is, that the very first request from
> any client is always a miss, this even happens on the same machine -
> using for example Firefox for the first request (miss), then curl -I
> (miss), then Firefox (hit), then curl -I (hit). Every request after
> that is a cache hit. Let's say I request "localhost/foo" using Firefox
> and it's a miss (and then gets cached), shouldn't "curl -I
> http://localhost/foo" right after that be a hit? Is this expected
> behavior, or a mis-configuration?
The objects are most likely being cached independently. The most likely
suspect is the headers you Vary on. For pressflow, I believe that will be
Cookie and Accept-Encoding by default. If those are not normalized in
Varnish you will cache one object for each variation (hence Vary:) of the
client-provided Accept-Encoding and Cookie headers.
Since pressflow doesn't send cookies for anonymous users, that only really
leaves accept-encoding - which is the most common header you have to
normalize anyway.
Take a look at the example on the wiki [1] for more discussion, and look
for a Vary header in the response from your web server.
[1] http://www.varnish-cache.org/trac/wiki/VCLExampleNormalizeAcceptEncoding
--
Kristian Lyngstøl
Product Specialist, Varnish Software
Training and Commercial services:
http://www.varnish-software.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20101119/085982d8/attachment-0003.pgp>
More information about the varnish-misc
mailing list