我遇到了與Varnish 4.x文檔不一致的情況。 根據文檔,每次從後端獲取對象時,都會調用vcl_backend_response,並且後端不會返回錯誤(並且存活且健康)。未調用Varnish vcl_backend_response
但是,我注意到許多'fetch'請求(由未命中導致)根本沒有經過這個函數。 下面是一個例子輸出:
- VCL_call HASH
- VCL_return lookup
- VCL_call MISS
- VCL_return fetch
- Link bereq 294915 fetch
- Timestamp Fetch: 1504198046.101306 0.003644 0.003644
- RespProtocol HTTP/1.1
- RespStatus 200
- RespReason OK
- RespHeader Server: nginx/1.10.3 (Ubuntu)
- RespHeader Date: Thu, 31 Aug 2017 16:47:26 GMT
- RespHeader Vary: Accept-Encoding
- RespHeader Last-Modified: Thu, 31 Aug 2017 16:42:58 GMT
- RespHeader Expires: Thu, 31 Aug 2017 16:47:26 GMT
- RespHeader Cache-Control: public, max-age=90, s-maxage=332
- RespHeader Pragma: cache
- RespHeader X-Lift-Version: 2.6.3
- RespHeader X-Frame-Options: SAMEORIGIN
- RespHeader Content-Encoding: gzip
- RespHeader Content-Type: application/json; charset=utf-8
- RespHeader X-Varnish: 294914
- RespHeader Age: 0
- RespHeader Via: 1.1 varnish-v4
- VCL_call DELIVER
- RespHeader grace: none
- VCL_return deliver
,而不是附着在文檔的流程:
- VCL_call BACKEND_FETCH
- VCL_return fetch
- BackendOpen 22 boot.default 127.0.0.1 9919 127.0.0.1 22536
- Timestamp Bereq: 1504198040.603601 0.000222 0.000222
- Timestamp Beresp: 1504198040.659723 0.056345 0.056123
- BerespProtocol HTTP/1.1
- BerespStatus 200
- BerespReason OK
- BerespHeader Server: nginx/1.10.3 (Ubuntu)
- BerespHeader Date: Thu, 31 Aug 2017 16:47:20 GMT
- BerespHeader Content-Type: text/html;charset=utf-8
- BerespHeader Transfer-Encoding: chunked
- BerespHeader Connection: keep-alive
- BerespHeader Vary: Accept-Encoding
- BerespHeader Last-Modified: Thu, 31 Aug 2017 16:42:58 GMT
- BerespHeader Expires: Thu, 31 Aug 2017 16:47:20 GMT
- BerespHeader Cache-Control: public, max-age=21600, s-maxage=21600
- BerespHeader Pragma: cache
- BerespHeader X-Lift-Version: 2.6.3
- BerespHeader X-Frame-Options: SAMEORIGIN
- BerespHeader Content-Encoding: gzip
- TTL RFC 21600 10 -1 1504198041 1504198041 1504198040 1504198040 21600
- VCL_call BACKEND_RESPONSE
所以 - 根據光油日誌 - 當有未命中並且對象是從取出不支持vcl_backend_response。 除非我錯過了一些東西 - 這與文檔相矛盾。