当我尝试通过Varnish Cache 4流mp3文件时,我的Varnish安装出现问题。
我有一个Drupal网站,编辑者可以在其中上传mp3。这些mp3列出在网站的一部分中,最终用户可以使用HTML 5播放器收听。 堆栈是:GNU / Linux Debian Jessie上的Varnish 4 <-> Nginx 1.11 <-> Drupal 7。 Varnish和Nginx随Debian软件包一起安装。
我的Varnish配置在这里:https://pastebin.com/8Kw1b2mL
当我尝试直接通过Nginx收听mp3时,一切正常:播放器加载了文件,我可以收听mp3。如果我尝试通过Varnish进行此操作,则播放器仍处于加载状态,而mp3无法启动。我尝试使用curl下载mp3文件,但请求超时。
我看了看varnishlog,这是输出:
* << Request >> 1409738
- Begin req 1246052 rxreq
- Timestamp Start: 1552587068.541997 0.000000 0.000000
- Timestamp Req: 1552587068.541997 0.000000 0.000000
- ReqStart 93.147.150.135 15330
- ReqMethod GET
- ReqURL /sites/default/files/audio/radio_interviews/20180927-rds-gr_rds_1700-170602593m_1.mp3
- ReqProtocol HTTP/1.1
- ReqHeader Host: www.xxx.it
- ReqHeader Connection: keep-alive
- ReqHeader Pragma: no-cache
- ReqHeader Cache-Control: no-cache
- ReqHeader Accept-Encoding: identity;q=1, *;q=0
- ReqHeader User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36
- ReqHeader chrome-proxy: frfr
- ReqHeader Accept: */*
- ReqHeader Referer: http://www.xxx.it/path/to/page/that/hosts/mp3file
- ReqHeader Accept-Language: en-US,en;q=0.9,es;q=0.8,fr;q=0.7,it;q=0.6
- ReqHeader Cookie: SESScookieagreed=2; has_js=1; _ga=GA1.2.950111086.1552579260; _gid=GA1.2.112403313.1552579260; __atuvc=2%7C11; _gat_UA-57096474-1=1
- ReqHeader Range: bytes=0-
- ReqHeader X-Forwarded-For: 93.147.150.135
- VCL_call RECV
- VCL_acl NO_MATCH allowed_monitors
- ReqUnset X-Forwarded-For: 93.147.150.135
- ReqHeader X-Forwarded-For: 93.147.150.135, 93.147.150.135
- ReqURL /sites/default/files/audio/mp3s/file.mp3
- ReqHeader x-range: bytes=0-
- ReqUnset Cookie: SESScookieagreed=2; has_js=1; _ga=GA1.2.950111086.1552579260; _gid=GA1.2.112403313.1552579260; __atuvc=2%7C11; _gat_UA-57096474-1=1
- VCL_return hash
- ReqUnset Accept-Encoding: identity;q=1, *;q=0
- VCL_call HASH
- ReqUnset Range: bytes=0-
- VCL_return lookup
- Hit 229378
- VCL_call HIT
- VCL_return fetch
- VCL_Error change return(fetch) to return(miss) in vcl_hit{}
- VCL_call MISS
- VCL_return fetch
- Link bereq 1409739 fetch
- Timestamp Fetch: 1552587068.542520 0.000523 0.000523
- RespProtocol HTTP/1.1
- RespStatus 200
- RespReason OK
- RespHeader Server: nginx/1.11.5
- RespHeader Date: Thu, 14 Mar 2019 18:11:08 GMT
- RespHeader Last-Modified: Fri, 28 Sep 2018 08:26:56 GMT
- RespHeader ETag: "5bade5d0-a0b94"
- RespHeader Content-Type: audio/mpeg
- RespHeader Content-Length: 658324
- RespHeader X-Cacheable: YES
- RespHeader X-Varnish: 1409738
- RespHeader Age: 0
- RespHeader Via: 1.1 varnish-v4
- VCL_call DELIVER
- RespHeader X-Cache: MISS
- RespHeader X-Cookie:
- RespHeader grace:
- RespHeader X-Varnish-Server: www.xxx.it
- VCL_return deliver
- Timestamp Process: 1552587068.542536 0.000539 0.000016
- RespHeader Accept-Ranges: bytes
- Debug "RES_MODE 2"
- RespHeader Connection: keep-alive
- Debug "Hit idle send timeout, wrote = 247608/658701; retrying"
- Debug "Write error, retval = -1, len = 411093, errno = Resource temporarily unavailable"
- Timestamp Resp: 1552587188.539239 119.997242 119.996703
- ReqAcct 733 0 733 377 658324 658701
- End
我不是Varnish的“宗师”,但看来错误是:
- Debug "Hit idle send timeout, wrote = 247608/658701; retrying"
- Debug "Write error, retval = -1, len = 411093, errno = Resource temporarily unavailable"
我在Google上搜索了很多内容,但是除了超时问题设置为60s(first_byte)(与Nginx相同)之外,我似乎没有发现超时问题。
我们非常感谢您的帮助。如果您需要其他信息,请告诉我。
预先感谢 丹妮尔