Re: [squid-users] Re: Reverse proxy always misses cache items (dynamic pages)

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 22 Dec 2013 16:34:39 +1300

On 21/12/2013 5:21 p.m., juan_fla wrote:
> Hi Amos,
>
> You mentioned as possible reasons for the cache to miss, the fact that the
> object is marked as private and the vary setting has cookie and
> accept-encoding.
>
> However, from reading this page:
> https://wikitech.wikimedia.org/wiki/MediaWiki_caching#Cache-control it looks

NOTE: This is the documentation of Wikipedia caching headers and why
they in particular use the settings they do. RFC 2616 gives each setting
its meanings. Just because a particular the setting meaning causes a
behavour they want does not mena that behaviour is the only one casued
by the setting. see below...

> like that is how it should be: private to allow browsers to cache the page,

Squid is not a browser though. Squid is termed a "shared cache" in the
RFC requirements. Private means shared caches (Squid) are NOT allowed to
cache it.

> vary: cookie so that when the user logs in, the page is not cached - but
> anon users should not have it cached, and accept-encoding to allow browsers
> that accept gzip to received compressed versions of the page.

Vary actually means that the content of the listed headers
(Accept-Encoding and Cookie in this case) are used to determine which of
multiple objects at that URL is the correct response.

With user login the only relevant detail is that logged in users present
*different* Cookie header contents (so could two non-logged in users),
resulting in different object being served to each. Any other client
presenting the same Cookie header would HIT the same object (lookup
replay attacks for more details).

Browser accepting gzip is not relevant, except that browser NOT
accepting gzip will have different headers to those which do. But
browsers which do are not necessarily presentign the same header.
Firefox, MSIE can each present different ones of "deflate,gzip"
"gzip,deflate", whic Chrome presents "gzip,deflate,sdch" ... which to
Vary are three different objects.
 Meaning that an object cached from Firefox MAY be a HIT or a MISS from
MSIE, and definitely will be a MISS for Chrome. etc.

>
> What do you think? Am I understanding it wrong? Do you think at this point I
> need to change settings on MediaWiki to alter these headers?

As that wiki page indicated the choice of settings is right for the
usage (assuming you are using them that way). I think your expectation
of a high HIT ratio while using them is where you are going wrong.

Amos
Received on Sun Dec 22 2013 - 03:34:51 MST

This archive was generated by hypermail 2.2.0 : Sun Dec 22 2013 - 12:00:04 MST