Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Dec 1999 17:08:23 -0600
From:      Jonathan Lemon <jlemon@americantv.com>
To:        Jason Nordwick <nordwick@erdos.hq.askjeeves.com>
Cc:        cmsedore@maxwell.syr.edu, hackers@FreeBSD.ORG
Subject:   Re: Practical limit for number of TCP connections?
Message-ID:  <19991221170823.39068@right.PCS>
In-Reply-To: <199912212355.PAA25570@erdos.hq.askjeeves.com>; from Jason Nordwick on Dec 12, 1999 at 03:55:18PM -0800
References:  <199912211522.JAA04702@free.pcs> <199912212355.PAA25570@erdos.hq.askjeeves.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 12, 1999 at 03:55:18PM -0800, Jason Nordwick wrote:
> 
> >In article <local.mail.freebsd-hackers/Pine.BSF.4.05.9912201950190.82375-100000@qwerty.maxwell.syr.edu> 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.
> >--
> >Jonathan
> >
> 
> I cannot believe that this is true.  It would seem, to me, that it is highly
> dependant on the density of the interest bit vector of select().  If it is
> very dense, then select is more appropriate.  Obviously, if you are only
> interested in fd# 5 and fd# 1000, then, yes, there is unecessary scanning.
> However is you are interested in 90% of the descriptors from 5 to 1000, then
> all the scanning is necessary.  (you can also, obviously, look through 32
> descriptors at a time).
> 
> Also, doesn't the kernel need to copy the argument arrays into kernel space.
> A struct pollfd is 8 bytes per interested descriptor, whereas, select() only
> needs 1 bit per interested descriptor.  If I am interested in 1000 descriptors
> (assuming in a row), that is 8000 bytes to copyin, versus 125 bytes.
> 
> Can somebody who knows better explain, please?

I'd suggest doing your own measurements.  :-)

Possibly it's application dependent.  For my application, the overhead
of copying more bytes is outweighed by the CPU time spent bit twiddling.
I'll also note that you can set up the poll array for 100% density, so
you don't have to copyin/out descriptors you aren't interested in.
--
Jonathan


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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