thierry.magnien at sfr
Nov 3, 2011, 9:14 AM
Post #1 of 2
Backend DNS lookup refresh
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.
varnish-misc mailing list
varnish-misc [at] varnish-cache