Key dates Varnish

Anders Berg andersb at vgnett.no
Mon Mar 13 23:31:56 CET 2006


> In message <1947.193.213.34.102.1141692949.squirrel at denise.vg.no>, "Anders
> Berg
> " writes:
>
>
> Here are some comments:
>
> 	req.ttlfactor
> 		I actually wanted to have one per request also, so that
> 		it is possible to decide that somebody isn't very important.
> 		(microsoft proxy thing)
>

What do you mean with that?

if (req.header.User-Agent ~ "MS Proxy"){
	req.ttlfactor = 1.5
}

Like this?
Would not:

if (req.header.User-Agent ~ "MS Proxy"){
	obj.ttl  += 10m
}


be the same?

As you can see I have noticed I really do not understand obj.ttl like
mentioned in notes1 (as I thought I did).

obj.ttl can either act like a modifier on the Expire output, on the object
itself, and as "deliver stale for ttl more seconds". Which one is it?

Lets say an object (index.html) expires:

Expires: Tue, 14 Mar 2006 16:00:00 GMT

from the backend.

The object is matched in the config.

if (req.url.path ~ "index.html"){
	obj.ttl += 10m
}

would the object stored in memory, or storage backend, be modified such
that Varnish reads:

Expires: Tue, 14 Mar 2006 16:10:00 GMT

next time? In that case well, that request would make it (if it is not
flagged as matching that exact reg-exp, which could be the case):

Expires: Tue, 14 Mar 2006 16:20:00 GMT

The document would never expire if we modify the object in memory or disk
(and don't flag it). So lets look at the other approach, where the object
is just modified on the "output" side.

The object gets:

Expires: Tue, 14 Mar 2006 16:00:00 GMT

from the backend. Is stored in memory, is requested, and delivers:

Expires: Tue, 14 Mar 2006 16:10:00 GMT

back to the requester.

@ Tue, 14 Mar 2006 16:00:01 GMT

we have to get a new document from the backend (we do not lighten load),
and lets say we delivered 3000 requests with:

Expires: Tue, 14 Mar 2006 16:10:00 GMT

well, 3000 clients are gonna request that document then (if they ask for
it again, which is the point, or else, obj.ttl has no meaning). What we
just did was to "buy" ourselvs 10 min at the first hit/request, nothing
more, because its a sliding window and does not lessen load on backend.

So I guess obj.ttl would be used to say that even if the document is
expired, let it live 10 more minutes in cache. Used like this:

Backend delivers a:

Expires: Tue, 14 Mar 2006 16:00:00 GMT

document to Varnish.

Request comes @ Tue, 14 Mar 2006 16:00:01 GMT and hits.

 if (req.header.User-Agent ~ "MS Proxy"){
	obj.ttl  += 10m
}

then old document is delivered.

This is the only way I can see this variable beeing used, and then it will
be the same as req.ttlfactor in my opinion. It does not really make sense
to use it on all requests, because then it would be the same as saying "I
don't wanna control my Expires from my backend", which one really should.
Or is this variable for controlling exactly that? "It's easier to do on
Varnish since I have 5 backends, so lets do it there".

Sorry for using so much text to say/ask so little. But I see it as one of
those "problems" that have to be discussed in detail.


Ab

> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by
> incompetence.
>
>




More information about the varnish-dev mailing list