best way to not cache large files?

AD straightflush at
Tue Mar 15 02:48:08 CET 2011

whats interesting is the last comment

 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)

What do you need to do via inline C to prevent the full 800 MB from
being downloaded even the first time?

On Mon, Mar 14, 2011 at 6:51 PM, Mark Moseley <moseleymark at> wrote:

> On Mon, Mar 14, 2011 at 3:30 PM, Chris Hecker <checker at> wrote:
> >
> > Anybody have any ideas?  They're not all the same mime type, so I think
> > putting them in an uncached dir is better if there's no way to figure it
> out
> > in vcl.
> >
> > Chris
> >
> >
> >
> > On 2011/03/13 07:26, AD wrote:
> >>
> >> i dont think you can check the body size (at least it seems that way
> >> with the existing req.* objects ).  If you know the mime-type of the
> >> file you might just be able to pipe the mime type if that works for all
> >> file sizes ?
> >>
> >> I wonder if there is a way to pass the req object into some inline C
> >> that can access the body somehow?
> >>
> >> On Sat, Mar 12, 2011 at 11:28 PM, Chris Hecker <checker at
> >> <mailto:checker at>> wrote:
> >>
> >>
> >>    I have a 400mb file that I just want apache to serve.  What's the
> >>    best way to do this?  I can put it in a directory and tell varnish
> >>    not to cache stuff that matches that dir, but I'd rather just make a
> >>    general rule that varnish should ignore >=20mb files or whatever.
> >>
> >>    Thanks,
> >>    Chris
> I was asking about the same thing in this thread:
> Check out Tollef's suggestion towards the end. That's what I've been
> using. The one drawback is that it's still fetched by varnish
> *completely* in the first, not-yet-restarted request, which means that
> a) you're fetching it twice; and b) it'll still stored albeit
> momentarily, so it'll evict stuff if there's not enough room.
> Before that, I wasn't sending any reqs for anything matching stuff
> like .avi or .wmv to varnish (from an nginx frontend).
> It'd be kind of neat if you could do a call-out and for anything
> matching a likely large file (i.e. has extension matching .avi, .wmv,
> etc), and do a HEAD request to determine the response size (or
> whatever you wanted to look for) before doing the GET.
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list