You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by "Henry C." <he...@cityweb.co.za> on 2011/11/01 07:19:17 UTC

Re: Trying to understand caching inconsistency with dynamic URLs (or cookies)

On Mon, October 31, 2011 23:30, Leif Hedstrom wrote:
> Well, if you vary: on user-agent, you are almost guaranteed to get a
> craptacular cache hit ratio. There are thousands (if not 10's of thousands) of
> variations of User-Agents. It's a real bad idea to vary: on it if you want any
> sort of cache hit ratio :).
>
> I'm stuck doing $work for a while, so haven't had time to get back on
> mailing lists activities, but just wanted to toss this one in here quickly.

Thanks Leif - correct me if I'm wrong:  when using a reverse proxy for the
acceleration benefits, one would think it's a reasonable expectation that
common objects will be served from the cache to anyone, willy-nilly,
irrespective of their stupid user-agent string, IP or whether their left cheek
is rubbing against their right.

Otherwise, what's the point?

There are probably other gotchas in the above scenario, but I ran into at
;east one:  if a page is cached, the language (ie, localisation) of which
depends on a cookie in the user's browser, then the wrong page will be served.
 It was at this point that I gave up (ie, trying to cache everything
irrespective of all user/browser/header issues), and focused instead on forced
caching of the one aspect of my application which desperately needed caching
and didn't depend on user stuff.

Anyway, good times.

-- 
Regards
Henry


Re: Trying to understand caching inconsistency with dynamic URLs (or cookies)

Posted by Leif Hedstrom <zw...@apache.org>.
On 11/01/2011 12:19 AM, Henry C. wrote:
> On Mon, October 31, 2011 23:30, Leif Hedstrom wrote:
>> Well, if you vary: on user-agent, you are almost guaranteed to get a
>> craptacular cache hit ratio. There are thousands (if not 10's of thousands) of
>> variations of User-Agents. It's a real bad idea to vary: on it if you want any
>> sort of cache hit ratio :).
>>
>> I'm stuck doing $work for a while, so haven't had time to get back on
>> mailing lists activities, but just wanted to toss this one in here quickly.
> Thanks Leif - correct me if I'm wrong:  when using a reverse proxy for the
> acceleration benefits, one would think it's a reasonable expectation that
> common objects will be served from the cache to anyone, willy-nilly,
> irrespective of their stupid user-agent string, IP or whether their left cheek
> is rubbing against their right.

Why would you make that assumption? If the origin says that it varies 
the content based on the User-Agent header (or any other header), the 
intermediary (proxy) has no other choice but to try to keep one version 
for every possible string. How else could it work? Intermediaries have 
no way of knowing that even if your origin lies and says Vary: 
User-Agent, it can ignore it. If that is the case, you really (*really*) 
have to modify your origin, not the intermediary.

Just to be clear, the issue is not the User-Agent string, it's that your 
Origin (it seems?) sends a Vary: on these "willy-nilly" headers.

>
> Otherwise, what's the point?

The point is that you have to obey the protocol, if not, you are very, 
very likely to give the wrong document to the users.

-- Leif