Varnish BackendPolling

BackendPolling can reduce Varnish 503 errors. Varnish poll by opening a new TCP connection to the backend on which we send a preconfigured request, wait for the answer and the connection to be closed by the backend. Only if Varnish get a ‘200’ reply back do we consider the probe good. Any thing other than ‘200’ means backend sick.

While configuring probe be careful of timeout. If backend do not return 200 with in “timeout” then the probe will be marked as sick. Same for .window & .threshold. For example if 4 probe out of 10 marked as sick then the backed will be marked as “Sick“. Then varnish will show 503 error. So its better to keep the .threshold as small as possible.

backend web {
  .host = "www.website.com";  # IP address of your backend (Apache, nginx, etc.)
  .port = "8000";       # Port your backend is listening on
  .connect_timeout = 600s;
  .first_byte_timeout = 600s;
  .between_bytes_timeout = 600s;
  .probe = {
     .url = "/";
     .timeout = 30s;
     .interval = 20s;
     .window = 10;
     .threshold = 4;
  }
}

you can check backend health using this commad

varnishadm debug.health

null

About Zakir Hyder

This entry was written by .

16. September 2014 by Zakir Hyder
Categories: Linux, Varnish | Tags: , , , , | Comments