It's a good idea to look at the varnishlog
output. You pasted client-side varnishlog output, but the reason why fetches fail is reported in the backend-side varnishlog output.
The part where the backend request happens will have a FetchError
tag, that will tell you what was going on.
Looking for fetch errors
Here's an example where I reached the backend's connection timeout:
FetchError backend boot.default: fail errno 110 (Connection timed out)
Here's an example where I reached the backend's first byte timeout:
FetchError HTC idle (3)
It could also be that your health probe already detected that the backend was unhealthy. Then you'll get the following output:
FetchError backend boot.default: unhealthy
In that case, it's a matter of looking at the backend_health
tag, that is not part of your request transaction log. The next section describes how to do this.
Monitor health probes
Because you defined a probe, you can even check the backend's health without sending requests to Varnish. Just run the following varnishlog
command:
varnishlog -g raw -i backend_health
With your current probe settings, this is the output you can get when all of the sudden, the backend goes down:
0 Backend_health - boot.default Still healthy 4---X-RH 10 5 10 0.007322 0.008134 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy -------- 9 5 10 0.000000 0.008378 Open error 110 (Connection timed out)
0 Backend_health - boot.default Still healthy -------- 8 5 10 0.000000 0.008378 Open error 110 (Connection timed out)
0 Backend_health - boot.default Still healthy -------- 7 5 10 0.000000 0.008378 Open error 110 (Connection timed out)
0 Backend_health - boot.default Still healthy -------- 6 5 10 0.000000 0.008378 Open error 110 (Connection timed out)
0 Backend_health - boot.default Still healthy -------- 5 5 10 0.000000 0.008378 Open error 113 (No route to host)
0 Backend_health - boot.default Went sick -------- 4 5 10 0.000000 0.008378 Open error 113 (No route to host)
0 Backend_health - boot.default Still sick -------- 3 5 10 0.000000 0.008378 Open error 113 (No route to host)
Your probe treshold is set to 5, you probe window is 10, and the probing interval is 5 seconds. This means that every 5 seconds is check is done. If 5 out of 10 checks fail, the backend will be considered sick.
Here's an example of first byte timeout issues while polling:
0 Backend_health - boot.default Still healthy 4---X-RH 8 5 10 0.007883 0.007988 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy 4---X-RH 9 5 10 0.006643 0.007651 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy 4---X-RH 10 5 10 0.009310 0.008066 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy 4---X-RH 10 5 10 0.007814 0.008003 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy 4---Xr-- 9 5 10 0.000000 0.008003 Poll error 0 (Success)
0 Backend_health - boot.default Still healthy 4---Xr-- 8 5 10 0.000000 0.008003 Poll error 0 (Success)
0 Backend_health - boot.default Still healthy 4---Xr-- 7 5 10 0.000000 0.008003 Poll error 0 (Success)
0 Backend_health - boot.default Still healthy 4---Xr-- 6 5 10 0.000000 0.008003 Poll error 0 (Success)
0 Backend_health - boot.default Still healthy 4---X-RH 6 5 10 1.008046 0.258014 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy 4---X-RH 6 5 10 1.009443 0.445871 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy 4---Xr-- 5 5 10 0.000000 0.445871 Poll error 0 (Success)
0 Backend_health - boot.default Went sick 4---Xr-- 4 5 10 0.000000 0.445871 Poll error 0 (Success)
0 Backend_health - boot.default Still sick 4---Xr-- 3 5 10 0.000000 0.445871 Poll error 0 (Success)
And finally, here's an example of a backend returning an HTTP/1.1 500
error:
0 Backend_health - boot.default Still healthy 4---X-RH 8 5 10 0.007650 0.051617 HTTP/1.1 200 OK
0 Backend_health - boot.default Still healthy 4---X-R- 8 5 10 0.007428 0.051617 HTTP/1.1 500 Internal Server Error
0 Backend_health - boot.default Still healthy 4---X-R- 7 5 10 0.006010 0.051617 HTTP/1.1 500 Internal Server Error
0 Backend_health - boot.default Still healthy 4---X-R- 6 5 10 0.009069 0.051617 HTTP/1.1 500 Internal Server Error
0 Backend_health - boot.default Still healthy 4---X-R- 5 5 10 0.006412 0.051617 HTTP/1.1 500 Internal Server Error
0 Backend_health - boot.default Went sick 4---X-R- 4 5 10 0.008542 0.051617 HTTP/1.1 500 Internal Server Error
0 Backend_health - boot.default Still sick 4---X-R- 3 5 10 0.007250 0.051617 HTTP/1.1 500 Internal Server Error
Conclusion
You're definitely looking in the right direction using varnishlog
, you just need to harness a bit more of its power to get the desired outcome.
Hope this helps.