Mailing List Archive

vcl file for caching flash video?
Hi,
I'm testing varnish for caching flash video content for a youtube
style site. I wrote a very simple vcl file for the site.
the backend is lighttpd, contents in the backend are all flash videos
(.flv files).
Is there any problem in my vcl file?

backend default {
set backend.host = "IP address";
set backend.port = "http";
}

sub vcl_recv {
if (req.request != "GET" && req.request != "HEAD") {
pipe;
}
if (req.http.Expect) {
pipe;
}
lookup;
}//no cookie, no auth needed; just look up the cache...

sub vcl_hit {
deliver;
}//deliver each hit from cache

sub vcl_miss {
fetch;
}

sub vcl_fetch {
if (!obj.valid) {
error;
}
set obj.ttl = 31536000s;
insert;
}//flash video never change, so cache everything for 1 year

sub vcl_timeout {
discard;
}
vcl file for caching flash video? [ In reply to ]
In message <8e98d9eb0703282206i7b567cfenf6d9427e69fa9301 at mail.gmail.com>, "Kang
Liu" writes:
>Hi,
>I'm testing varnish for caching flash video content for a youtube
>style site. I wrote a very simple vcl file for the site.
>the backend is lighttpd, contents in the backend are all flash videos
>(.flv files).
>Is there any problem in my vcl file?

None that I see.

You don't need to copy the default VCL, it's always used if you
have not specified anything, so you should not need the vcl_hit,
vcl_miss and vcl_timeout functions.

VCL understands more time units than seconds, so you could have
written:
set obj.ttl = 365d;

--
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.