cURL / Mailing Lists / curl-library / Single Mail


Re: curl with c-ares

From: Daniel Stenberg <>
Date: Wed, 4 Sep 2013 14:06:26 +0200 (CEST)

On Tue, 3 Sep 2013, Shao, Shuchao wrote:

> Via checking the C-ares souce code, there are two large 'for' loops in
> function ares_init_options(),

> #define ARES_QID_TABLE_SIZE 2048

My immediate gut reactions:

1 - try with much smaller values, like 89 and 47 (primes) and I doubt you'll
see much of a run-time speed penalty but you'll get much faster initing.

2 - maybe we should allow these values to get settable with an API? They seem
to be set to cater for a very large volume of DNS request over a single handle
and maybe not all users need that. It is also a memory waste for the low
volume users.

I'm probably in favour of lowering those default values awaiting 2 (unless
someone reports a major speed penalty).

> My question is if we can do the c-ares initiation only once but not in every
> curl_easy_init()? By that probably we can increase the curl-loader
> performance significantly.


In the TODO docs it is somewhat hidden, but since a long time I've been
wanting to make the c-ares channel within an easy handle possible to both be
explicitly shared by easy handles (using the share API) and I would like the
multi handle to "own" the c-ares channel when that is used as then all easy
handles would use that single channel instead of setting up their own.

I'm not aware of anything particular that stands in the way of just making it
happen. It is mostly about actually writing the code and making sure it
works... I'll appreciate patches!

List admin:
Received on 2013-09-04