From owner-freebsd-hackers Tue Dec 21 13:16: 3 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from alcanet.com.au (border.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (Postfix) with ESMTP id 7C72D15140 for ; Tue, 21 Dec 1999 13:15:57 -0800 (PST) (envelope-from jeremyp@gsmx07.alcatel.com.au) Received: by border.alcanet.com.au id <40323>; Wed, 22 Dec 1999 08:07:02 +1100 Content-return: prohibited Date: Wed, 22 Dec 1999 08:15:48 +1100 From: Peter Jeremy Subject: Re: Practical limit for number of TCP connections? To: hackers@FreeBSD.ORG Message-Id: <99Dec22.080702est.40323@border.alcanet.com.au> MIME-version: 1.0 X-Mailer: Mutt 1.0i Content-type: text/plain; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 21 Dec 1999 09:22:04 -0600 (CST), Jonathan Lemon wrote: >In article you write: >>In my case, load is reasonably distributed. Is poll() really that much >>better than select()? I thought that, excepting bit flag manipulations, >>it worked basically the same way on the kernel end. > >Yes, it is better. Select uses the same backend as poll(), but those >"bit flag manipulations" that you are talking about consume a measurable >amount of CPU time when you start throwing thousands of descriptors at it. I'm not as sure that it's that clear cut. poll(2) requires far more copyin/copyout than select(2) (8 bytes per fd instead of 1-3 bits/fd). And if it's the bit twiddling that you're worried about, the kernel has to check 10 bits in each pollfd entry, rather than the 1-3 bits for select(2). If you have a very sparse set of FD's to select on, then poll(2) should be better. I suspect the normal server case is closer to selecting on fds [3 .. nfds-1] - so select(2) is probably faster. poll(2) does have advantages over select(2): - Separate input-only and output-only fields mean you may not need to separately keep (or re-generate) the list of events of interest. - A wider range of states/events can be requested/reported. Has anyone done any timing comparisons between poll(2) and select(2)? Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message