Hostnames in backend definition...

Hettwer, Marian mhettwer at
Wed Dec 14 16:26:22 CET 2011

Hi there,

On 14.12.11 11:56, "Poul-Henning Kamp" <phk at> wrote:

>In message <CB0E33BC.1A17A%mhettwer at>, "Hettwer, Marian"
>>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.

Well, that would either mean, set the backend to fail, or use the first IP
But as you said, you had your talks about it, so I guess the decision is
settled for now.

>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.

I can understand this. On the other hand, even in your own datacenter
setup, one might need to change dns records. Restarting a service for that
is just... Well... painful. (I'm just thinking about our hundreds of
tomcats, where java is also treating DNS not as one might expect. But this
gets off-topic).

>>The initial DNS answer would include a TTL, indicating how long the
>>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 :-(

Oh crap.
So that's the reason why there's so much OSS around which just plain
caches DNS forever after startup?
I wonder how caching dns servers are doing it (thinking of pdns-resolver).
On the other hand, I've seen a whole shitload of badly behaving dns
cachers. So probably it again boils down to no standardized way to do it.
Crap indeed.

But thanks for your insights! :)


More information about the varnish-misc mailing list