cURL / Mailing Lists / curl-library / Single Mail


Re: Multi interface and DNS load balancing

From: Seppo Heikkilä <>
Date: Thu, 11 Dec 2014 19:14:00 +0100

>> DNS load balancing is quite common so this should work quite easily.
> It isn't easy. getaddrinfo() returns the addresses in a prio order and we
> through the addresses in that order. How are you suggesting we change this
> without overriding the users' /etc/gai.conf, RFC 3484 and whatever more
> need to be taken into account? Of course, involving c-ares complicates
> slightly more too... I'm open for suggestions and patches on how to
improve this.

True, does not look that easy. Thanks for the explanation! My example had
also one bug with share handles. The code should have sharehandles[i] and
not sharehandles[0]. Thus assigning separate share handles seems to still
work also at least with c-ares.

Probably I keep my current solution, which is to resolve the hostname at
the beginning and assign IPs manually using CURLOPT_RESOLVE. So basically
having my own DNS cache layer in the end. An updated multi-app.c
demonstrating this approach is attached for those who might be interested.


List admin:

Received on 2014-12-11