[PATCH proposal] RE: Backend DNS lookup refresh

MAGNIEN, Thierry thierry.magnien at sfr.com
Tue Nov 15 11:50:41 CET 2011


Here is a first version of a patch to add the "vcl.reload" function to CLI, in order to refresh DNS lookups without having to send a new VCL or restart varnish.

It is far from perfect but may be used as a starting point. It applies on master and of course all comments are welcome.


-----Message d'origine-----
De : varnish-misc-bounces at varnish-cache.org [mailto:varnish-misc-bounces at varnish-cache.org] De la part de MAGNIEN, Thierry
Envoyé : jeudi 3 novembre 2011 17:15
À : 'varnish-misc at varnish-cache.org' (varnish-misc at varnish-cache.org)
Objet : Backend DNS lookup refresh

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.


varnish-misc mailing list
varnish-misc at varnish-cache.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vcl.reload.patch
Type: application/octet-stream
Size: 5198 bytes
Desc: vcl.reload.patch
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111115/adf138d9/attachment-0003.obj>

More information about the varnish-misc mailing list