数日前、Varnish 4.1.2 を Debian 8.4 64 ビットに展開しました...サービス構成は問題ありませんが、ストリーミングを開始している間、ストリーミングは 60 秒間フリーズし、その後再び自動的に次の 2 または 3 分間実行を開始します。さらに60秒間フリーズします.. Varnish 3でこの問題に直面していませんが...
これが私のワニス4.1.2構成です...
default.conf
> vcl 4.0;
import std; import directors; import querystring;
backend server1 { .host = "192.168.4.1"; .probe = {
.url = "/hls/newtv/index.m3u8";
.interval = 5s;
.timeout = 1s;
.window = 5;
.threshold = 3; } }
sub vcl_init { new vdir = directors.round_robin(); vdir.add_backend(server1); }
sub vcl_recv { set req.backend_hint = vdir.backend(); # send all traffic to the vdir director set req.http.Host = regsub(req.http.Host, ":[0-9]+", ""); set req.url = std.querysort(req.url);
if (req.url ~ "^[^?]*\.(m3u8)(\?.*)?$") {
unset req.http.Cookie;
return (hash); }
if (req.http.Authorization) {
# Not cacheable by default
return (pass); }
return (hash); } sub vcl_pipe { if (req.http.upgrade) {
set bereq.http.upgrade = req.http.upgrade; }
return (pipe); }
sub vcl_hash {
if (req.method == "GET" || req.method == "HEAD") {
hash_data(querystring.remove(req.url));
}
else {
hash_data(req.url);
}
hash_data(req.http.host);
return (lookup);
}
sub vcl_hit {
if (obj.ttl >= 0s) {
return (deliver); }
if (std.healthy(req.backend_hint)) {
if (obj.ttl + 10s > 0s) {
return (deliver);
} else {
return(fetch);
} } else {
if (obj.ttl + obj.grace > 0s) {
return (deliver);
} else {
return (fetch);
} } return (fetch); # Dead code, keep as a safeguard }
sub vcl_miss { return (fetch); }
sub vcl_backend_response { if (beresp.http.Surrogate-Control ~ "ESI/1.0") {
unset beresp.http.Surrogate-Control;
set beresp.do_esi = true; }
if (bereq.url ~ "^[^?]*\.(m3u8)(\?.*)?$") {
unset beresp.http.set-cookie; }
if (bereq.url ~ "^[^?]*\.(m3u8)(\?.*)?$") {
unset beresp.http.set-cookie;
set beresp.do_stream = true;
set beresp.do_gzip = false; }
if (beresp.status == 301 || beresp.status == 302) {
set beresp.http.Location = regsub(beresp.http.Location, ":[0-9]+", ""); }
if (beresp.status == 500 || beresp.status == 502 || beresp.status == 503 || beresp.status == 504) {
return (abandon); }
set beresp.grace = 6h;
return (deliver); }
sub vcl_deliver {
if (obj.hits > 0) { # Add debug header to see if it's a HIT/MISS and the number of hits, disable when not needed
set resp.http.X-Cache = "HIT"; } else { set resp.http.X-Cache = "MISS"; }
set resp.http.X-Cache-Hits = obj.hits;
return (deliver); }
sub vcl_purge { if (req.method != "PURGE") {
# restart request
set req.http.X-Purge = "Yes";
return(restart); } }
sub vcl_synth { if (resp.status == 720) {
set resp.http.Location = resp.reason;
set resp.status = 301;
return (deliver); } elseif (resp.status == 721) {
set resp.http.Location = resp.reason;
set resp.status = 302;
return (deliver); }
return (deliver); }
sub vcl_fini {
return (ok); }
そして /etc/default/varnish
START=yes
NFILES=131072
MEMLOCK=82000
DAEMON_OPTS="-a 192.168.2.1:80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
誰でも問題を解決できますか!!!
前もって感謝します...