On Thu, Sep 3, 2015 at 2:41 AM, Cyrus Hall <cy...@justin.tv> wrote: > Hi! > > I've searched the list and not found much on lengthy HAProxy start/config > load times. We tend to run HAProxy with a large number of backends (100+), > and recently noticed that we are seeing lengthy reload times (20+ seconds). > This is most noticeable in locations that are far away from our DNS server. > We've traced this back to HAProxy doing sequential DNS lookup, one address > at a time, and the long RTT to our DNS servers (~200ms). As such, load > times tend to be N*M ms, where N is the number of backends and M is the RTT > to the DNS server. > > While searching the mailing list, there was a little discussion about using > getaddrinfo_a for making DNS queries asynchronous. I can not find any signs > of this work in the latest development branch release. Is anyone currently > working on it, and if not, is it something that the project would be > interested in seeing? > > Cheers, > Cyrus > > -- > > Cyrus Hall | Lead Software Engineer | Twitch | 720-327-0344 | > cy...@twitch.tv > >
Hi Cyrus, A few weeks ago, I discussed a similar issue in a thread: initial IP address of a server. Purpose was to discus the introduction of a new statement to let know HAProxy how to handle DNS resolution of servers. This statement would take multiple values, such as 'libc', 'a.b.c.d' (an arbitrary IP address), 'internal resolver', etc... This feature will fix your issue, combined with the new 'resolvers' feature (and maybe the upcoming 'server-state' which keeps server IPs when DNS resolution is enabled on a server). Basically, you'll be able to force an IP to 0.0.0.0, then let HAProxy's internal resolver (it is asynchronous and performs multiple resolutions in parallel). To speed up start up, the new server-state feature will apply last resolved IP to server which rely on DNS to resolve their IP addresses. All of this should be available in 1.6. In the mean time, I would recommend using a local DNS cache, such as dnsmasq. Baptiste