Subject: Re: Per query timeouts

Re: Per query timeouts

From: William Ahern <william_at_25thandclement.com>
Date: 2006-01-18

On Mon, Jan 16, 2006 at 10:05:58PM -0800, William Ahern wrote:
> Has anybody worked on per query timeouts? If not, anybody care to offer
> their opinions on how it should be shoe-horned in? Off the top of my head
> I'm thinking of making ares_query() a wrapper around ares_query_ts() (or
> some such name), where ares_query() passes channel->timeout as the last
> parameter to ares_query_ts(), and ares_query_ts() can be called directly
> otherwise.
>
> - Bill

Allow me to add a little more background ;)

The timeout is relative to the logical query, not to each server. So that,
if you pass a query timeout of 10 seconds, but the ares channel is
configured for a server timeout of 3 seconds, a try count of 2, and 2 hosts
in resolv.conf you'd actually be cutting short the query by 2 seconds (from
12 to 10).

I need this because I have a wrapper on top of c-ares (which hopefully I can
release soon) which can do compound queries--"give me the sorted list of A
records for the MX records of foo.bar"--in one abstract operation. If the
requester wants the query to timeout in 10 seconds I need a way to pass a
timeout remainder to each query I do through ares.

So far it seems simply being able to pass a logical timeout for the ares
query should solve all problems. Everything is configurable in one way or
another. I toyed with being able to pass more options on a per-query basis
but that seems overkill. I've gone through the scenarios and it doesn't seem
worth it.

- Bill
Received on Wed Jan 18 01:35:39 2006