Backend DNS lookup refresh

MAGNIEN, Thierry thierry.magnien at sfr.com
Thu Nov 3 17:14:50 CET 2011


Hi all,

We are dealing with a great number of backends in our VCL file and we have problems with some backends changing IP address (for example when hosted on services such as Amazon S3, that switch IP address without telling anyone).

We would like to be able to refresh the DNS resolution of backends when needed and after a quick look at the source code, it seems there are several ways to handle this.

I would like to get your feeling about what would be the best solution before trying to write a patch, so here are my thoughts, just as it comes out of my mind ;-)

DNS resolution of backends is done when the VCL is loaded. IP address is stored in the compiled VCL as a sockaddr struct.

The first way to solve the problem would be to implement a "vcl reload" CLI function. In that case, this needs some tricks to be able to recompile a VCL which has the same name of the one used.

A 2nd way would be to make backend IP addresses resolved when needed (at first backend request and then cached for a "TTL" time), and not at VCL loading. However, this breaks most of the the optimization brought by the sockaddr structure.

A point discussed quickly with Per Buer on IRC was to have probes checking the IP addresses of the backends and update when an IP change is detected.

All this makes me think that it's not so easy as it could seem, and that's why I would accept any advice/idea/comment about this.

Regards,
Thierry





More information about the varnish-misc mailing list