varnish 5.0: varnish slow when backends do not respond?

Hu Bert revirii at
Tue Feb 5 11:55:31 UTC 2019

Hi Guillaume,

the backend config looks like this (just questioning a simple file
from tomcat); maybe params are wrong? :

backend tomcat_backend1 {
   .host = "";
   .port = "8082";
   .connect_timeout = 15s;
   .first_byte_timeout = 60s;
   .between_bytes_timeout = 15s;
   .probe = {
       .url = "/portal/info.txt";
       .timeout = 10s;
       .interval = 1m;
       .window = 3;
       .threshold = 1;

The backend is shown as 'sick', but the time until you get an answer
from nginx/varnish differs, from below a second to 7 or more seconds -
but the requested image is already in cache (hits >= 1).

Imho the cache should work and deliver a cached file, independent from
a (non) working backend. Maybe beresp.ttl messed up?

    else if (beresp.status<300) {
[lots of rules]
    } else {
       # Use very short caching time for error messages - giving the
system the chance to recover
       set beresp.ttl = 10s;
       unset beresp.http.Cache-Control;


Am Di., 5. Feb. 2019 um 12:33 Uhr schrieb Guillaume Quintard
<guillaume at>:
> Hi,
> Do you have probes set up? If you do, the backend will be declared sick and varnish will reply instantly without even trying to contact it.
> It sounds like that at the moment, varnish just tries to get whatever it can, waiting for as long as authorized.
> Cheers,
> On Tue, Feb 5, 2019, 11:51 Hu Bert <revirii at wrote:
>> Hey there,
>> i hope i'm right here... i have the following setup to deliver images:
>> nginx: https -> forward request to varnish 5.0
>> if image is not in cache -> forward request to backend nginx
>> backend nginx: delivers file to varnish if found on harddisk
>> if backend nginx doesn't find: forward request to 2 backend tomcats to
>> calculate the desired image
>> The 2 backend tomcats do deliver another webapp (and are a varnish
>> backend as well); at the moment they're quite busy and stop working
>> due to heavy load (->restart), the result is that varnish sees/thinks
>> that the backends are sick. Somehow then even the cached images are
>> delivered after a quite long waiting period, e.g. a 5 KB image takes
>> more than 7 seconds.
>> Is this the normal behaviour that varnish does answer slowly if some
>> backends are sick?
>> If any other information is need i can provide the necessary stuff.
>> Thx in advance
>> Hubert
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at

More information about the varnish-misc mailing list