Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Aug 2005 14:04:54 +1000
From:      Peter Jeremy <PeterJeremy@optushome.com.au>
To:        Robert Watson <rwatson@freebsd.org>
Cc:        arch@freebsd.org
Subject:   Re: [CFR] reflect resolv.conf update to running application
Message-ID:  <20050821040454.GP13959@cirb503493.alcatel.com.au>
In-Reply-To: <20050821003536.P14178@fledge.watson.org>
References:  <ygefyt4yiaz.wl%ume@mahoroba.org> <20050821003536.P14178@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Overall, I think that having applications see changes to /etc/resolv.conf
is a good idea.

On Sun, 2005-Aug-21 00:37:56 +0100, Robert Watson wrote:
>(1) Has anyone characterized the significant of the cost of doing a stat()
>    for every DNS lookup for a significant workload?  Does it matter?

I wrote a short program to run stat("/etc/resolv.conf") in a loop.
On a P-233 running 4.9, I got about 45000 iterations/sec.
On a P-120 running 5.4, I got about 10500 iterations/sec.
I don't think this matters - especially compared to the overheads
involved in sending and receiving the DNS UDP packets.  If you are
stating the same name frequently, it will be in the name cache so
the name lookups are fairly cheap.

>(2) By reading the configuration file more frequently and more quickly
>    after a change, we increase the chances of a race condition in which
>    the resolve reads a partially written resolv.conf file during an
>    update.  Does this happen in practice?

This could be more of an issue, though I have no idea whether it
really is.  The easy work-around is to avoid updates.  Instead create
/etc/resolv.conf.tmp and rename it.

-- 
Peter Jeremy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050821040454.GP13959>