Hostnames in backend definition...

Poul-Henning Kamp phk at
Wed Dec 14 11:56:17 CET 2011

In message <CB0E33BC.1A17A%mhettwer at>, "Hettwer, Marian" writes:

>Does varnish cache DNS entries forever and does the dns lookup only once
>at startup time?
>If so, why would it do that?

Varnish does the DNS lookup at VCL compiler time.

This is to avoid DNS-server trouble impacting varnish doing its job.

We have talked about having the health-probe do DNS lookups in the
background, but there are some interesting cornercases that needs
to be dealt with, for instance:  What happens when we suddenly get
two IP#'s back, or when we get no ip numbers back.

The advantage to doing the DNS lookup and error checking at VCL compile
time, is that we have a CLI connection to report trouble on.

>The initial DNS answer would include a TTL, indicating how long the record
>is valid.

Yes, and no standardized API returns that TTL to the application
program, so all you can do is call getaddrinfo() periodically, at
whatever frequency you deem appropriate :-(

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-misc mailing list