Varnish config rules to cache large MP3 and PDF files?
Reading suggestion: https://www.varnish-software.com/blog/http-streaming-varnish
With vanilla Varnish 3.0 you could set beresp.do_stream to true in vcl_fetch. The file will be streamed while it is fetched from backend. The caveat: The object is set to busy while streaming, so other clients will be put on hold.
There is also a Varnish 3.0.2 release with baked in "full" streaming support available: http://repo.varnish-cache.org/test/3.0.2+streaming/ which people are using in production, so maybe you want to give it a try.
Or maybe you could "prewarm" your files, placing them in the Varnish memory cache before users start downloading it?
The 3.0.2+streaming branch is not up-to-date anymore and it is only supported for Varnish Plus subscribers, no community support on that.
So if you need streaming capabilities you can either:
- Try Varnish Plus (only available to subscribers) which has built in support for it.
- Test and see if the upcoming Varnish Cache 4.0 (release expected in Q2 2014) solves this issue for you (it should).