obj.ttl derived?

David Birdsong david.birdsong at gmail.com
Mon Sep 14 21:52:15 CEST 2009


On Mon, Sep 14, 2009 at 12:45 PM, Kristian Lyngstol
<kristian at redpill-linpro.com> wrote:
> On Mon, Sep 14, 2009 at 12:43:20PM -0700, David Birdsong wrote:
>> On Mon, Sep 14, 2009 at 12:38 PM, David Birdsong
>> <david.birdsong at gmail.com> wrote:
>> > awesome, thanks.  this explains poor cache-hit ratio.
>> >
>> > On Mon, Sep 14, 2009 at 12:22 PM, Kristian Lyngstol
>> > <kristian at redpill-linpro.com> wrote:
>> >> On Mon, Sep 14, 2009 at 11:57:25AM -0700, David Birdsong wrote:
>> >>> How is obj.ttl derived when both Expires and max-age is set by the backends?
>> >>>
>> >>> We had a case where the backend was setting Expires to 60seconds after
>> >>> the request and max-age was 5184000.  Additionally in vcl_fetch:
>> >>>
>> >>> sub vcl_fetch {
>> >>>         if (obj.ttl < 9000s) {
>> >>>                 set obj.ttl = 9000s;
>> >>>         }
>> >>> }
>> >>>
>> >>> What would obj.ttl be set to given the Expires and max-age contradiction?
>> >>
>> >> If s-maxage is set, use that as default, otherwise use max-age as default.
>> >>
>> >> If Expires is sooner than the default, use that.
>> >>
>> >> So in your example, the ttl should be 60s.
>> oh, to clarify...
>>
>> would the stanza in vcl_fetch override the obj.ttl which was set by
>> the Expire header?
>> sub vcl_fetch {
>>        if (obj.ttl < 9000s) {
>>                set obj.ttl = 9000s;
>>        }
>> }
>>
>> or do I have the order wrong?
>
> Ah, yes, it would, I misread the < as >, sorry about that.
>
> But are you sure you're getting hits at all?

varnistat shows hitrate around .54 for 10 and 1000 second averages.  N
expired objects is anywhere between 10-40 second though and varnishd
has only been running for about 12 hours.  i expect the hit rate to
drop sharply as peak traffic continues to diminish for the day.

i think a 9000s obj.ttl is a complete mistake on our part. so i've
followed some of the steps found here
http://varnish.projects.linpro.no/wiki/VCLExampleLongerCaching
on 1 of our servers.  i'm going to compare it in a day or so.

why do you ask though?


>
> --
> Kristian Lyngstøl
> Redpill Linpro AS
> Tlf: +47 21544179
> Mob: +47 99014497
>



More information about the varnish-misc mailing list