From owner-freebsd-net@FreeBSD.ORG Tue Jul 15 23:43:15 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC7B11065671 for ; Tue, 15 Jul 2008 23:43:15 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail10.syd.optusnet.com.au (mail10.syd.optusnet.com.au [211.29.132.191]) by mx1.freebsd.org (Postfix) with ESMTP id 531998FC13 for ; Tue, 15 Jul 2008 23:43:15 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c122-106-215-175.belrs3.nsw.optusnet.com.au [122.106.215.175]) by mail10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m6FNgu5Z030687 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Jul 2008 09:43:00 +1000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.2/8.14.2) with ESMTP id m6FNguHZ099160; Wed, 16 Jul 2008 09:42:56 +1000 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.2/8.14.2/Submit) id m6FNgsg5099159; Wed, 16 Jul 2008 09:42:54 +1000 (EST) (envelope-from peter) Date: Wed, 16 Jul 2008 09:42:54 +1000 From: Peter Jeremy To: Bakul Shah Message-ID: <20080715234254.GZ62764@server.vk2pj.dyndns.org> References: <20080715230917.DAC3B5B46@mail.bitblocks.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FoibaoN3dya3u5fy" Content-Disposition: inline In-Reply-To: <20080715230917.DAC3B5B46@mail.bitblocks.com> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.18 (2008-05-17) Cc: "JINMEI Tatuya / ?$B?@L@C#:H" , Thomas Vogt , freebsd-net@freebsd.org Subject: Re: too many open file descriptors messages since bind 9.4.2-P1 (port dns94) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2008 23:43:15 -0000 --FoibaoN3dya3u5fy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2008-Jul-15 16:09:17 -0700, Bakul Shah wrote: >IIRC, when poll() returns n, you only look at the first n >values in the pollfd array so it is a win when you expect a >very small number of fds to be ready. In the select case you >have to test the bit array until you see the last ready fd. No. Both poll(2) and select(2) return the number of FDs ready for I/O. You need to scan the pollfd or fd_set array until you find that many FDs ready. poll(2) is a win if you only need to test a small number of FDs compared to the number of FDs that the process has open. In the case of bind, you have a large number of FDs to test, of which you are only expecting a very small number to be ready - if you don't treat fd_set as opaque, select(2) allows you to quickly skip large (roughly wordsize) chunks of un-interesting FDs. Note that, based on sys_generic.c in 7.x and -CURRENT, poll(2) is limited to checking FD_SETSIZE descriptors, whilst select(2) has no upper limit. --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --FoibaoN3dya3u5fy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkh9Nf4ACgkQ/opHv/APuIdj8QCcDoK8GqnIVYsXpwhO2Gb57jW1 0dEAnjPKIwfegANc3GRD19L3wMJfWfEp =AhqU -----END PGP SIGNATURE----- --FoibaoN3dya3u5fy--