Dealing with large unwanted objects

Tollef Fog Heen tfheen at
Wed Nov 17 15:09:49 CET 2010

]] Mark Moseley 

| On Fri, Nov 5, 2010 at 1:10 AM, Tollef Fog Heen
| <tfheen at> wrote:
| > ]] Mark Moseley
| >
| > | Wow, that's cool. I figured that the body had also been completely
| > | fetched by the time vcl_fetch is invoked, so that changes things
| > | completely. I'll definitely give this a try.
| >
| > It is in 2.0, but not in 2.1.
| >
| > | BTW, is there any "cast" trick to be able to use arithmetic operators
| > | like ">" with beresp.http.Content-Length (or other numeric headers)?
| >
| > There'll be a way to do that in 3.0, yes.
| So if it's not fetched the complete body yet, once 'restart' is
| called, does varnish just dump the body?

No, we don't.

| When I tried out your recipe
| (which works like a charm, btw), I noticed that varnish still reads
| the entirety of the first (i.e. the restarted one) request's response
| body, before proceeding to fetch the restarted request.

We need to do this, since the backend has already filled the connection
with the body of the request, we just haven't read it.  Alternatively,
we could close the connection and open a new one, but that might well
have a higher overhead.

| All this happens over localhost, so it's quite fast, but in the
| interest of efficiency, is there something I can set or call so that
| it closes that first connection almost immediately? Having to refetch
| a 800meg file off of NFS might hurt -- even if a good chunk of it is
| still in the OS block cache.

You'd need to do this using inline C, but yes, anything is possible.
(Sorry, I don't have an example for it here)

Tollef Fog Heen
Varnish Software
t: +47 21 98 62 64

More information about the varnish-misc mailing list