stale delivery and prefetch sanity check...

Jon Drukman jsd at cluttered.com
Mon Apr 21 20:30:42 CEST 2008


Poul-Henning Kamp wrote:
> If any of you have time, your comments to this outline for degraded
> mode and prefetching would be appreciated.

Looks like a great start to me.  Is there an approximate timeframe (very 
rough is OK) for when we might see these features?

> Prefetch
> --------
> 
> Prefetching is easy to dispatch with: at some VCL determined time
> before the TTL expires, we try to refresh the object from the backend
> so that it never grows stale.

would you replace the current object as soon as the prefetch succeeds, 
or wait until the current one expires?

> The simplest solution is probably to replay the headers used to
> fetch the object in the first place, but this may wrongly account
> the fetch to a particular client/cookie/user/account.
> 
> The alternative is to filter headers to the bare minimum, respecting
> Vary:, and hope that gives the expected result.

yeah it seems like either of these choices could be very tricky.  maybe 
make it configurable?

> For the lack of any better idea, I think all prefetching will look like
> it happend from a client with IP# 127.0.0.2

How about a header?  X-Varnish-Prefetch: true and don't mess with the IP 
at all.

> Degraded mode
> -------------
> 
> Degraded mode is the intentional serving of technically stale objects
> instead of returning errors.

oh man, i really need this :)

> The condition for returning stale content is:
> 
> * Client must be marked as accepting degraded objects (VCL:
>   "client.degraded = true", default true) before lookup.
> 
> * Object must be within it's timelimit for degraded mode (VCL:
>   "obj.stale_time = 1h", default 30 seconds).

as long as the timelimit can be set to something ridiculously high.

> * An attempt to fetch the object from the backend must be in progress
>   or recently (VCL: "backend.backoff = 1m", default 15 seconds) have failed.

are you planning on having this work asynchronously? (ie: object 
expires, stale object is served to all requestors while the new one is 
retrieved from the origin, if the origin fails to serve a new one, the 
old one continues to serve while the stale_time window is still open).

-jsd-




More information about the varnish-misc mailing list